owntracks / recorder

Store and access data published by OwnTracks apps
Other
888 stars 122 forks source link

View not found #377

Closed eghetto closed 2 years ago

eghetto commented 2 years ago

Created my my custom json (r9.json) in /var/spool/owntracks/recorder/htdocs/views like this:

{
  "user"  : "d",
  "device": "redmi9",
  "page"  : "vmap.html",
  "hours" : "12",
  "label" : "D (Redmi 9)",
  "zoom"  : 12
}

http://192.168.0.32:8084/view/r9 returns "View not found"

my settings:

        WITH_MQTT = yes
        WITH_HTTP = yes
        WITH_PING = yes
        CONFIGFILE = "/etc/default/ot-recorder"
        STORAGEDEFAULT = "/var/spool/owntracks/recorder/store"
        STORAGEDIR = "/var/spool/owntracks/recorder/store"
        DOCROOT = "/var/spool/owntracks/recorder/htdocs"
        GHASHPREC = 7
        DEFAULT_HISTORY_HOURS = 6
        JSON_INDENT = "NULL"
        LIBMOSQUITTO_VERSION = 1.5.7
        MDB VERSION = LMDB 0.9.22: (March 21, 2018)
        GIT VERSION = 0.8.4-31-g5b0cc477cb

Am I missing something?

Thanks!

jpmens commented 2 years ago

The configuration looks ok to me. Have you tried specifying option --viewsdir to the Recorder to set the directory explicitly?

Do you see anything untoward / any diagnostics on the Recorder's console when you attemt to access the view?

eghetto commented 2 years ago

Thank you!

Indeed using the option --viewsdir explicitly did the trick for me!

However how do I modify my /usr/share/doc/ot-recorder/ot-recorder.service in order to accept the additional --viewsdir argument?

No luck with...: ExecStart=/usr/sbin/ot-recorder '--viewsdir /var/spool/owntracks/recorder/htdocs/views'

jpmens commented 2 years ago

You are specifying that as one argument, where it must be two (the option is one, its value a second) so removing the single quotes ought to do the trick:

ExecStart=/usr/sbin/ot-recorder --viewsdir /var/spool/owntracks/recorder/htdocs/views
jpmens commented 2 years ago

Marking as bug because viewdir ought to default to _docsdir_/views

eghetto commented 2 years ago

Thanks!

I realized I had to modify /etc/systemd/system/ot-recorder.service instead of /usr/share/doc/ot-recorder/ot-recorder.service

ExecStart=/usr/sbin/ot-recorder --viewsdir /var/spool/owntracks/recorder/htdocs/views

works fine after systemctl daemon-reload

Thank you very much for the great support - keep up the good work! 👍

jpmens commented 2 years ago

It turns out this is likely not a bug as <DOCROOT>/views is default for the views directory. Looking at this issue again, I see that you tried

http://192.168.0.32:8084/view/r9 returns "View not found"

The URL should have said /views/r9 (plural).

I'll assume that was the cause for confusion, so I'll close this now. By all means say if you think that's not right. :-)