• Add direct filebase access from the web server (optional)

    From Deucе@1:103/705 to GitLab note in main/sbbs on Sat Jan 22 21:30:44 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/1ab2956baad6304f3510f091cb0b9d4baed45330#note_2212

    This should be a new dynamic type. This is doing something very different than what a static webserver does.
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to GitLab note in main/sbbs on Sat Jan 22 21:33:32 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/1ab2956baad6304f3510f091cb0b9d4baed45330#note_2213

    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.
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to GitLab note in main/sbbs on Sat Jan 22 21:39:24 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/1ab2956baad6304f3510f091cb0b9d4baed45330#note_2215

    This if/else block bothers me since the two are testing very different things. Both tests should be required to pass if both end up applicable somehow.
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to GitLab note in main/sbbs on Sat Jan 22 21:48:28 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/1ab2956baad6304f3510f091cb0b9d4baed45330#note_2216

    This should be outside of the if(), and with file access being a dynamic type, the test below it would naturally move out as well.
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to GitLab note in main/sbbs on Sat Jan 22 21:49:18 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/1ab2956baad6304f3510f091cb0b9d4baed45330#note_2217

    This is a great time to refactor this block into a separate function that applies webctrl.ini. It may be a good time to remove access.ars support as well.
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab note in main/sbbs on Sat Jan 22 22:06:18 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/1ab2956baad6304f3510f091cb0b9d4baed45330#note_2218

    The return value of this function is assigned to session->req.dynamic which is then later most often tested as if it's a bool, e.g.``` if(session->req.dynamic) /* Need to re-copy path here in case of re-checked PathInfoIndex change */ SAFECOPY(path,session->req.physical_path);```Many of these checks would have to be changed to specific range or value checks since the conditional blocks mostly do not apply to filebase/download requests.Since the content of a filebase response is not dynamically generated, I don't see why IS_STATIC is not the appropriate type.
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab note in main/sbbs on Sat Jan 22 22:09:06 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/1ab2956baad6304f3510f091cb0b9d4baed45330#note_2219

    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.
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab note in main/sbbs on Sat Jan 22 22:18:48 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/1ab2956baad6304f3510f091cb0b9d4baed45330#note_2220

    Another example where a non-zero session->req.dynamic value would do the wrong thing for a filebase request:``` /* Entity Headers */ if(session->req.dynamic) { safe_snprintf(header,sizeof(header),"%s: %s",get_header(HEAD_ALLOW),"GET, HEAD, POST, OPTIONS"); safecat(headers,header,MAX_HEADERS_SIZE); safe_snprintf(header,sizeof(header),"%s: %s",get_header(HEAD_ACCEPT_RANGES),"none"); safecat(headers,header,MAX_HEADERS_SIZE); } else { safe_snprintf(header,sizeof(header),"%s: %s",get_header(HEAD_ALLOW),"GET, HEAD, OPTIONS"); safecat(headers,header,MAX_HEADERS_SIZE); safe_snprintf(header,sizeof(header),"%s: %s",get_header(HEAD_ACCEPT_RANGES),"bytes"); safecat(headers,header,MAX_HEADERS_SIZE);
    }```
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to GitLab note in main/sbbs on Mon Jan 24 02:12:40 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/1ab2956baad6304f3510f091cb0b9d4baed45330#note_2222

    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 URLsFilebaseRedirect=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/```
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab note in main/sbbs on Tue Jan 25 21:53:36 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/1ab2956baad6304f3510f091cb0b9d4baed45330#note_2231

    ```[files/]# For auto-generated URLsFilebaseRedirect=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.
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to GitLab note in main/sbbs on Tue Jan 25 23:47:04 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/1ab2956baad6304f3510f091cb0b9d4baed45330#note_2232

    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.
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab note in main/sbbs on Wed Jan 26 00:14:14 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/1ab2956baad6304f3510f091cb0b9d4baed45330#note_2233

    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?
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to GitLab note in main/sbbs on Wed Jan 26 21:12:36 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/1ab2956baad6304f3510f091cb0b9d4baed45330#note_2235

    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.
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to GitLab note in main/sbbs on Wed Jan 26 21:17:02 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/1ab2956baad6304f3510f091cb0b9d4baed45330#note_2236

    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.
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)