esitarski / CrossMgr

Cyclo Cross Management Application
MIT License
40 stars 20 forks source link

Add custom page to webserver #110

Open jezza323 opened 1 year ago

jezza323 commented 1 year ago

I've got a nice touch screen oriented page I've written to make use of /bib.js handling for manual timing, and would like to host it using the Crossmgr webserver

I apologise, I'm not experienced with python at all. It looks like webserver.py will handle routes outside the default set by attempting to load from file, but I can't determine what path from. I guessed crossmgrhtml in the install path but that doesn't seem to be the case

Any tips on how to find the correct pathing?

Windows 11, Crossmgr 3.1.17

esitarski commented 1 year ago

At present, the built-in CrossMgr web server can only serve its own content, which is dynamically generated based on live race data. It doesn't serve general web pages. It isn't a real web server and isn't able to pull scripts or style sheets from external websites (which would be the first bug report I would get).

Your touch-screen web page sounds cool, but did you know that CrossMgr has a touch-screen interface built-in? On the Record screen there is an icon that looks like a bulls-eye (the touch icon). This makes the display touch friendly (i.e. with input buttons).

Warning about touch screens: The first release of CrossMgr was heavily built on a touch-screen. It's a little-known fact that touch screens get sluggish/unresponsive in cold weather (eg. https://discussions.apple.com/thread/250919610). It's usually OK for a phone that is kept warm in your pocket, but when a touch screen gets cold (0C), you have to hold your finger on the button for a few seconds before it works. This problem seems to be a limitation of the touch screen itself (and perhaps the freezing finger). This completely messes up data entry, and I got numerous bug reports about it (which, of course, I couldn't fix). So, the keyboard input is the default.

On Wed, Mar 29, 2023 at 4:21 PM jezza323 @.***> wrote:

I've got a nice touch screen oriented page I've written to make use of /bib.js handling for manual timing, and would like to host it using the Crossmgr webserver

I apologise, I'm not experienced with python at all. It looks like webserver.py will handle routes outside the default set by attempting to load from file, but I can't determine what path from. I guessed crossmgrhtml in the install path but that doesn't seem to be the case

Any tips on how to find the correct pathing?

Windows 11, Crossmgr 3.1.17

— Reply to this email directly, view it on GitHub https://github.com/esitarski/CrossMgr/issues/110, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABGXKNI6BEQK7RCOXQYBR3W6SKUBANCNFSM6AAAAAAWML2OVA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

--

Edward Sitarski

esitarski commented 1 year ago

Touch screens also struggle when they get hot too. It's not always possible to move to somewhere cooler at a race.

On Wed, Mar 29, 2023 at 8:09 PM Edward Sitarski @.***> wrote:

At present, the built-in CrossMgr web server can only serve its own content, which is dynamically generated based on live race data. It doesn't serve general web pages. It isn't a real web server and isn't able to pull scripts or style sheets from external websites (which would be the first bug report I would get).

Your touch-screen web page sounds cool, but did you know that CrossMgr has a touch-screen interface built-in? On the Record screen there is an icon that looks like a bulls-eye (the touch icon). This makes the display touch friendly (i.e. with input buttons).

Warning about touch screens: The first release of CrossMgr was heavily built on a touch-screen. It's a little-known fact that touch screens get sluggish/unresponsive in cold weather (eg. https://discussions.apple.com/thread/250919610). It's usually OK for a phone that is kept warm in your pocket, but when a touch screen gets cold (0C), you have to hold your finger on the button for a few seconds before it works. This problem seems to be a limitation of the touch screen itself (and perhaps the freezing finger). This completely messes up data entry, and I got numerous bug reports about it (which, of course, I couldn't fix). So, the keyboard input is the default.

On Wed, Mar 29, 2023 at 4:21 PM jezza323 @.***> wrote:

I've got a nice touch screen oriented page I've written to make use of /bib.js handling for manual timing, and would like to host it using the Crossmgr webserver

I apologise, I'm not experienced with python at all. It looks like webserver.py will handle routes outside the default set by attempting to load from file, but I can't determine what path from. I guessed crossmgrhtml in the install path but that doesn't seem to be the case

Any tips on how to find the correct pathing?

Windows 11, Crossmgr 3.1.17

— Reply to this email directly, view it on GitHub https://github.com/esitarski/CrossMgr/issues/110, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABGXKNI6BEQK7RCOXQYBR3W6SKUBANCNFSM6AAAAAAWML2OVA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

--

Edward Sitarski

--

Edward Sitarski

jezza323 commented 1 year ago

Thanks, I thought it looked like it would load some files from disk if the route couldnt be matched (line 521, webserver.py) but I cant work out what "os.path.basename(up.path)" would result in, looks like its not what I thought it was

I am aware of the Record touch input option on CrossMgr, the page I've created has a button per bib # in the current race, not just 0-9, much quicker inputs when manual timing (just press #30) instead of 3, then 0, then enter). Works fine with a mouse also of course, or on a tablet, or on a phone

It functions fine on an alternate webserver (eg IIS), just need to tell it where CrossMgr is listening. If i can run it off the local webserver it can just post to the current page host + "/bib.js" instead of having to configure the target url, and dont need to install an extra item.

Would you consider merging a PR that added this to the app (new source html file & webserver.py support)? If not I wont go to the trouble to make it fully self contained etc

Looks like this currently, but to make it self contained I will simplify the styling quite a lot

image