Add direct filebase access from the web server (optional)
By setting SCFG->File Options->Web File Virtual Path Prefix to something (e.g. "/files/"), all HTTP or HTTPS requests to the Synchronet Web Server with request paths beginning with this prefix will be interpreted as filebase access requests (with full access control enforcement). This is configured here (in SCFG) rather than, say, the [web] section of sbbs.ini, because I have plans for the terminal server to use this prefix to generate Web-URLs for files to display or email to users. Currently, only requests to *files* (for download) are supported (no index generation, file information, etc. and definitely no upload support). Full access control (using HTTP auth, not cookies) is used for libraries and directories with controlled access. Credits are deducted and awarded and uploaders are notified of downloads, as one would expect. Requests to any dynamic-web-content files (e.g. .SSJS, .XJS, etc.) will be treated as static file download requests (no script will be executed). I'm reusing the same virtual path parsing logic from the FTP server (moved to the userdat lib), so the virtual path to a file for download would be, for example, http://yourdomain/files/lib/dir-code/filename.ext The main motivation for this feature is: FTP-links in email and web pages are just not useful to many users these days and I don't think that sysops should have to rely on a SSJS web UI (e.g. ecWebv4, cool as it is), to provide web-access to the filebases. Using this feature, you can share simpler/shorter web links to your files that will be more enduring.
- src/sbbs3/ftpsrvr.c 3 additions, 51 deletionssrc/sbbs3/ftpsrvr.c
- src/sbbs3/scfg/scfgxfr1.c 21 additions, 1 deletionsrc/sbbs3/scfg/scfgxfr1.c
- src/sbbs3/scfgdefs.h 1 addition, 0 deletionssrc/sbbs3/scfgdefs.h
- src/sbbs3/scfglib2.c 4 additions, 1 deletionsrc/sbbs3/scfglib2.c
- src/sbbs3/scfgsave.c 5 additions, 1 deletionsrc/sbbs3/scfgsave.c
- src/sbbs3/userdat.c 51 additions, 3 deletionssrc/sbbs3/userdat.c
- src/sbbs3/userdat.h 1 addition, 0 deletionssrc/sbbs3/userdat.h
- src/sbbs3/websrvr.c 152 additions, 104 deletionssrc/sbbs3/websrvr.c
-
This should be configured/accessible via webctrl.ini so you can map directories wherever you want, as many times as you want. While I see a need for the BBS to know how to construct a URL, it's very limiting to force a single specific prefix for all file access. It would be much better to be able to map files and directories... would even help tick off the long TODO item of user dirs.
-
It would be located in the directory where the redirection happens. If you're redirecting the entire filebase for example, the root webctrl.ini could be something like:
[files/] # For auto-generated URLs FilebaseRedirect=bbs:// [Synchronet/] FilebaseRedirect=bbs://main/sbbs/ [Synchronet_Archive/] FilebaseRedirect=bbs://main/sbbs_arc/ [sbbs_win32.zip] FilebaseRedirect=bbs://main/sbbs/sbbs319b.zip [sbbs_src.tgz] FilebaseRedirect=bbs://main/sbbs/sbbs_src.tgz [sbbs_src.zip] FilebaseRedirect=bbs://main/sbbs/sbbs_src.zip [sbbsimsg.lst] FilebaseRedirect=/sbbs/ctrl/sbbsimsg.lst [syncterm.lst] FilebaseRedirect=bbs://main/sbbs/syncterm.lst [incoming/] FilebaseRedirect=bbs://main/uploads/ [docs/] FilebaseRedirect=bbs://main/sbbsdocs/
-
[files/] # For auto-generated URLs FilebaseRedirect=bbs://
So the problem I have with this approach is that I couldn't easily or reliably generate/share URLs to the filebase from the terminal server. I want to be able to display or email filebase URLs to users of the BBS and so I need to know the prefix (e.g. "files/" or whatever the sysop has configured) that's used to access the filebases via HTTP[S]. That is the reason I made this prefix string a member of scfg_t (and configured in SCFG->File Options) and exposed in JS using file_area.web_vpath_prefix.
Using the approach I took, I could have the web-root point anywhere and the filebase access "just works" and in the terminal server or even other servers or services, I can construct and share web URLs to the filebases.
-
It's pretty trivial to have the SCFG setting not be a web server setting, leaving the web server configuration together in one place. Given the web vpath and the web root, it could easily verify the webctrl.ini at startup and log an error if the configured redirect isn't in the webctrl.ini file.
-
I'm suggesting that the web server configuration all be done in the web server configuration, rather than adding an extra place for web server configuration to live because it's easier than parsing the [web] section of sbbs.ini.
I'm also suggesting that it would be a much nicer feature for the web server to be able to do file area redirects like ftp aliases using the existing configuration file system rather than adding another configuration file for the web server.
In my opinion though, configuring effectively the same path in two places that have difference effects (one place that exposes the file areas via the web server, and the other configuring generated URLs for filebase links) is better than just adding an extra place you need to configure the web server.