Skip to content
Snippets Groups Projects
Commit 1ab2956b authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

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.
parent d74c90dd
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2579 passed
Loading
  • Maintainer

    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.

  • Author Owner

    Where would the webctrl.ini that would control filebase access be located? I certainly wouldn't want to have to create a webctrl.ini file for every one of my file area storage directories. I guess I need more clarity on this suggestion.

  • Maintainer

    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/
  • Author Owner
    [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.

  • Maintainer

    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.

  • Author Owner

    It sounds like you're suggesting that having the filebase web-access prefix configured in 2 places would be better than having it configured in one place, like it is currently. Is that what you're suggesting?

  • Maintainer

    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.

  • Maintainer

    I just realized I haven't looked at how this works with vhosts, that's something that would need to be investigated as well. Hopefully the mapped prefix doesn't work on all vhosts.

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment