[ prog / sol / mona ]

prog


How can I run my own instance of this

140 2020-04-11 00:09

>>26
I've added those lines to the top of the server section of an nginx.conf file, and it does seem to work (after installing the nginx module posted by >>29).
My only question is about the first line: What is the value of the bypass variable? I assume that it would be some sort of match for pages that do not make use of the shared CSS files, but it would be nice to know if there's more to it.

142 2020-04-11 01:54 *

>>140
There are two modules used:
https://github.com/yaoweibin/ngx_http_substitutions_filter_module
https://github.com/aperezdc/ngx-fancyindex

The first one is used for the ``css toggle without cookies'' hack and the second is just to make nice directory listings.

I think some variables were missing in the post where I explained the css switching, so here's the part that takes care of adding the query strings to all links:

    server {

        if ( $query_string = "" )
        {
            set $bypass "1";
        }
        #replace css and add query string to all internal links
        subs_filter_bypass $bypass;
        subs_filter '<LINK href="/static/styles/(.*?).css"' '<LINK href="/static/styles/$arg_css.css"' or;
        subs_filter '<A href="((?!http).*?)(#.*?)?"' '<A href="$1$is_args$args$2"' gr;
        subs_filter '<FORM action="(.*?post)"' '<FORM action="$1$is_args$args"' gr;
    }

I call it a hack because in a perfect world, elements of your app should be loosely coupled and SchemeBBS would handle this, not Nginx. But sometimes you have to chose the way of the ninja especially for nice but non vital features.

cont. (I hit the post length limit. I got a new server today with decent specs so the site will be migrated and the post limit raised)

301


VIP:

do not edit these