Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

Posted on
Fri Feb 24, 2023 8:33 pm
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

Hi Benjamin,

I'm not sure if you're still active in the Indigo community but I figured I'd post here just in case.

I've been using your EventLog "web asset" plugin for many years now since it's a great way to filter and display the Indigo log, especially when troubleshooting an intermittent issue. In Indigo 2022.2, I now get "⚠️ 404 — Not Found Requested URL /Eventlog/index not found" when trying to use it. I have a sinking feeling that the web mechanism used for plugins in Indigo's Web Assets/plugins directory has been deprecated along with the REST API but I'm not sure.

So, do you (or Matt/Jay if you're listening) know if there is any hope for keeping this plugin going? If not, do you know of any other solutions for a more robust log viewer?

Thanks!

--Dave

Posted on
Fri Feb 24, 2023 9:16 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

That is correct, the new web server doesn't use those old IWS plugins. It was not possible to make them work with the new IWS architecture.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Feb 24, 2023 9:52 pm
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

Re: Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

Does the new web server have any mechanism for coding custom displays like this?

If not, perhaps eventually the Logs tab in Indigo Touch for Web could implement a more robust display like Benjamin's Remote Log Viewer. Come to think of it, I guess the EventLog python code could be converted to be served by Apache. Beyond my skills but maybe I can get some help to do it.

Posted on
Sat Feb 25, 2023 8:27 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

I don't know exactly what it does, but the current plugin mechanism can serve up web pages (and has been able to do so for a while), so most likely a plugin could be built to do whatever that old IWS plugin does.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Feb 25, 2023 9:16 am
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

Re: Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

I wish I could run it and show you what it does. In general, it parses all the saved log files into fields, like event type, time, message, etc and presents it in a nice grid format. You can filter by days, type, text, etc. There is a very old description of it at http://www.schollnick.net/wordpress/hom ... og-viewer/ which includes an example of part of the functionality.

Sorry to be so dense, but could you point me to any docs that describe how to serve up web pages driven by plugins? The docs at https://wiki.indigodomo.com/doku.php?id ... b_server&s[]=web&s[]=assets say "With Indigo 2022.2, web server plugins are no longer supported." I know how to access the static and public directories but I thought that is just for static content, not for web plugins.

Posted on
Sat Feb 25, 2023 10:41 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

DVDDave wrote:
Sorry to be so dense, but could you point me to any docs that describe how to serve up web pages driven by plugins?


https://wiki.indigodomo.com/doku.php?id ... our_plugin

There are several developers that are doing this, and there's an example HTTP Responder plugin in the SDK that is a good starting point (we haven't added an SDK release for 2022.2 yet, but all the examples in the 2022.1 work fine in 2022.2).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Feb 25, 2023 11:26 am
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

Re: Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

Thanks, Jay! I'll study this and see if I can adapt the old plugin python code to this method.

Posted on
Tue Feb 28, 2023 5:40 pm
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

Re: Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

Hi again Jay.

After a useful learning experience on how plugins are constructed to act as a web server and lots of trial and error, I mostly have the EventLog viewer working as a plugin in 2022.2.

However, the log data is being displayed in the browser as text instead of interpreted html. The tags look right but a possible clue to the problem is that when I try to save the returned page in Safari, it wants to save it as type "json".

Any idea why this might be happening and what I need to do in the plugin code to return proper html?

Thanks.

--Dave

Edit: The server is indeed returning an application/json. response header. Is there any way I can change that?

Posted on
Wed Mar 01, 2023 10:04 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

Check out the section of the docs that describes what you can reply. (look for Content-Type header references)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Mar 01, 2023 2:35 pm
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

Re: Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

Got it working! Thanks for pointing me in the right direction, Jay. Now need to do a bunch of cleanup to restore full functionality.

Posted on
Thu Mar 02, 2023 1:08 am
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

Re: Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

On my last cleanup item, I ran into a snag. I'm trying to enable the style sheet and javascript that was included in the original plugin. However the server doesn't seem to be treating the files as the correct type. If I save the resulting html and serve it from the static directory, the css and js files load fine. Looking at the result with the browser development tools, it seems that the css and js source is displaying the html result instead of the style and javascript code.

Any idea why the browser would not treat the html returned from the plugin the same way it does for the static page? Looking at the result with the browser development tools, it seems that the css and js source is displaying the html result instead of the style and javascript code. I suspect it has something to do with content-type headers again but I can't figure out how to separately change the content-type header info for the referenced css and js files.

Sorry for all the questions and I really appreciate the advice. Kinda hard since there aren't many examples of this kind of plugin. The http responser example was helpful but it takes a very different approach to the stylesheets with an html template. It would be a major chore to convert to that approach.

Posted on
Fri Mar 03, 2023 4:41 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

Can you copy/paste some code examples of how the CSS and JS files are being served currently?

And how you are including them in your dynamic HTML?

Image

Posted on
Fri Mar 03, 2023 7:17 pm
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

Re: Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

Here is what I include in the dynamic html to reference the css file and 2 javascript files:
Code: Select all
      html_elems.append ("<head>\n")
      html_elems.append ('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\n')
      html_elems.append("<title>Indigo log viewer</title></Head>\n")
      html_elems.append('<link rel="stylesheet" type="text/css" href="css/EventLog.css">')
      html_elems.append ('<meta name="apple-mobile-web-app-capable" content="yes">')
      html_elems.append ('<meta name="viewport" content="width=320,initial-scale=0.8,maximum-scale=1.6,user-scalable=yes"/>')
      html_elems.append("<body>\n")
      html_elems.append ('''<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/tablekit.js"></script>''')

Then when the server defaulted to json as the content type even though different content-types were specified, I added this at the end to specify a header with text/html:
Code: Select all
      html_elems.append("</body>\n")
      #html_elems.append("</html>\n")
      #indigo.server.log("html_elems = " + str(html_elems))
      #content_type = indigo.utils.FILE_EXTENSION_MIME_MAP.get(os.path.splitext(indigo_path[-1])[-1].strip("."), "text/html")
      reply = indigo.Dict()
      reply["headers"] = indigo.Dict({"Content-Type": "text/html"})
      reply["content"] = ''.join(html_elems)
      return reply

The problem is that I don't know how to specify different content types for each of the referenced files. I thought that is what the type specs are for but apparently not. This approach did work with the older IWS.

The oddest thing is that when I save the resulting file as a html file and serve it directly, the referenced style sheet works fine. I don't know what the difference is between serving the python constructed dynamic html versus serving the html file static file resulting from that dynamic html..

I was able to get it working partially by including the styles inline with the <style> tag but that approach didn't work with the javascript and was unwieldy due to the size of the file.

Thanks, Matt

--Dave

Posted on
Fri Mar 03, 2023 7:56 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

Where are those files stored inside your plugin?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Mar 03, 2023 8:23 pm
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

Re: Remote Log Viewer (EventLog web plugin) kaput in 2022.2?

In this case, the the css and js directories are in the same directory as plugin.py. I've also tried putting them in the plugin's static directory with the same result. In all cases, they are found correctly.

Who is online

Users browsing this forum: No registered users and 12 guests