[ Home / * / RSS ] [ b / c / g / lit / guestbook ] [ k / a / min / t / m ] [ Deepswarm / Services ] [ Search / Rules / Mod ]

/g/ - Technology

"The version with Linux, we call “GNU/Linux.” It is OK to call it “GNU” when you want to be really short, but it is better to call it “GNU/Linux” so as to give Torvalds some credit."
[Return][Go to bottom]
Name (Name could be empty, then a random name will be used from a pool.)
Options(sage: append your comment to a thread without bumping it; noko: after commenting, make your url stay inside the thread.)
Subject
Comment
File
Ext: jpg|jpeg|png|txt|conf|org|md|pdf|epub, Media:mp3|flac|webm; Max Size: 12M (Sum of all files);
Embed

Markup Guide

  • heading: use ## as 2nd heading and ### as 3rd.
  • inline code, use `
  • strong text, use **
  • italic text, use * or _ (single underscore)
  • slash the text, use ~~
  • underline the text, use __, enclosing text in double underscores.
  • Make hyperlink, directly paste url or use markdown syntax: [Link name](the url)
  • Goth the text, use [[ and ]]; Garamond the text, use (( and ))
  • Spolier the text, use ==; Make the text glowing, use ::
  • Make Kiketext, use ((( and )))
  • link inline meme/smiley, use double plus signs ++http://dswarmsikhttkg7jgsoyfiqpj3ighupfrvuz5ri3lu5q2dlqyrpgk7ad.onion/css/e/b0.webp++
  • code block, use ```:

    ```
    // comment
    some code
    ```

  • A place for testing markup: /test. I'll clean test threads from time to time, so use it when you're not sure.
  • Use >>NUM (double) to make reference in-board,
  • use >>>/SLUG/NUM (triple) to reference any post of any board.

    File: 1712737818228.png (12.08 KB, 200x204,vichan-200.png)

     No.5

    View phpinfo(); in moderator dashboard
    1. In /inc/config.php:
    $config['file_mod_php_info'] = 'mod/php_info.html';
    $config['mod']['view_php_info'] = MOD;
    2. Define a function in /inc/mod/pages.php:
    function mod_php_info() {
    	global $config;
    	if (!hasPermission($config['mod']['view_php_info']))
    		error($config['error']['noaccess']);
    	// get content
        ob_start();
        phpinfo();
        $php_info_content = ob_get_clean();
        mod_page(_('PHP info'), $config['file_mod_php_info'], array('php_info_content' => $php_info_content));
    }
    Here the mod page titled PHP info is built (together with stylesheets, boardlist & footer, like every other mod pages), and variable php_info_content is constructed by array, this variable will be used in html files, to call out the whole php info table. So in the file
    /mod/php_info.html

    we only need to write:
    {{php_info_content}}
    Note that mod_page should have 3 args.

     No.6

    >>5
    This can also be done without touching /inc/mod/pages.php:

    $config['mod']['custom_pages']['/php_info.html'] = function() {
    		global $config;
    		if (!hasPermission($config['mod']['view_php_info']))
    			error($config['error']['noaccess']);
    		    ob_start();
    		    phpinfo();
    		    $php_info_content = ob_get_clean();
    		    mod_page(_('PHP info'), $config['file_mod_php_info'], array('php_info_content' => $php_info_content));
    	};

    And is best served with:

    $config['mod']['dashboard_links']['PHP info'] = '?/php_info.html';

     No.7

    >>6
    Nicely done! I guess it would be easy to set up ukko and index page for mod in this way. Btw, saw your new reply banner, lol. Is there a way to just show a blinking text over the banner using css or js? Consider implementing this. It's done.

     No.8

    >>7
    ukko is in actual fact easy, it's even documented:

    	// You can also enable themes (like ukko) in mod panel like this:
    	require_once("templates/themes/ukko/theme.php");
    	$config['mod']['custom_pages']['/\*/index.html'] = function() {
    	       global $mod;
    	       $ukko = new ukko();
    	       $ukko->settings = array();
    	       $ukko->settings['uri'] = '*';
    	       $ukko->settings['title'] = 'Universe';
    	       $ukko->settings['subtitle'] = '...but, since we no longer conceive ourselves to be quantifying over a fully determinate totality, we shall have no motive to do so.';
    	       $ukko->settings['thread_limit'] = 15;
    	       $ukko->settings['exclude'] = '';
    	       echo $ukko->build($mod);
    	};

    Index is not really possible since there's a conflict between the dashboard link and the index, unless you really do some heavy modification.

    And… nice!

     No.9

    >>8
    Successfully loaded.

     No.10

    >>8
    >some heavy modification
    Lol, really don’t want to touch any php function and js. But I may still can’t stop myself optimizing some vichan shit code. Wow, just take a look at those js with long css code appended…
    quick-reply.js is really good.

     No.11

    File: 1712838869108.txt (6.53 KB,quick-reply.txt)

    >>10
    I've actually modified it a lot (deleted all the css lines and further meaningless lines) and disabled fade in and fade out.

     No.12

    >>11
    Also why not consider gzipping css and js etc. files in nginx, it helps a lot. An 1mb mathjax script (tex-chtml.js) reduced to 250kb. I have quite a lot of scripts loaded (but compiled):

    	$config['additional_javascript'] = array();
    	$config['additional_javascript'][] = 'js/jquery-3.7.1.min.js';
    	$config['additional_javascript'][] = 'js/inline-expanding.js';
    	$config['additional_javascript'][] = 'js/expand.js';
    	$config['additional_javascript'][] = 'js/expand-too-long.js';
    	$config['additional_javascript'][] = 'js/hide-threads.js';
    	$config['additional_javascript'][] = 'js/post-hover.js';
    	$config['additional_javascript'][] = 'js/show-backlinks.js';
            $config['additional_javascript'][] = 'js/expand-video.js';
    	$config['additional_javascript'][] = 'js/jquery-ui.draggable.min.js';
    	$config['additional_javascript'][] = 'js/quick-reply.js';
    	$config['additional_javascript'][] = 'js/multi-image.js';

    but in terms of transfer it only costs around 48kb, smaller than a single jquery.min.js.

            gzip on;
    	gzip_vary on;
    	gzip_min_length 1100;
    	gzip_proxied any;
    	gzip_comp_level 6;
    	gzip_buffers 4 32k;
            gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;

     No.13

    >>12
    Must give a try this compression! jquery.min.js is a nightmare. Extreme aversion to the kind of files that are compressed together, e.g. SearXNG css file.

     No.14

    File: 1712853723256.png (709.08 KB, 800x438,js.png)

    >>13
    I'm trying this one https://chan.itinerariummentis.org/g/res/10-vichan-observatory.html#28
    Btw, does using a min.js file really load faster than the original js? This tendency of the js community is so funny… remember Luke talked about it once.

     No.15

    >>11
    js/quick-reply.js     | 260 +++++++++++++++++++++++--------------------------------------------------------------------------
    Perfect.

     No.16

    >>14
    I guess no one really want to modify jquery, which is a framework similar to mathjax (and take a look at tex-chtml.js), so using the minified version, around 85kb, is certainly better than using the full one, around 250kb (if I remember correctly).

     No.18

    >>16
    Yay, it makes sense if the size is greatly reduced.

     No.68


    In your origin server A
    Generates the sql file: mysqldump -u vichan -p vichan_db > vichan.sql, then transfer vichan.sql to the target server B.

    Server B
    follow the installation process at https://comfy.guide/server/vichan/ then after "installation complete",

    mysql -u vichan -p
    [ENTER YOUR PASSWORD] then you enter the mysql prompt
    
    use vichan_db;
    DROP TABLE posts_b;
    SOURCE /path/to/vichan.sql;
    exit


    Copy /img /src /thumb folders from server A to server B
    assume the structure of your /var/www folder of server B is:
    - "chan.deep-swarm.xyz" (server B files)
    - "dschandata" (copied from server A)
    - "html" (other softwares)

    manually
    cd /var/www
    cp -r dschandata/a/{img,src,thumb} chan.deep-swarm.xyz/a
    cp -r dschandata/b/{img,src,thumb} chan.deep-swarm.xyz/b
    cp -r dschandata/c/{img,src,thumb} chan.deep-swarm.xyz/c
    ...


    script
    OR directly use a script (before doing this click every boards in the mod.php page to make sure have generated folder-files of new boards):
    for FOLDER_NAME in \* a b c g guestbook k lit m min t test; do
        cp -r dschandata/$FOLDER_NAME/{img,src,thumb} chan.deep-swarm.xyz/$FOLDER_NAME
    done


    Possible issues
    1. some files are not writable when "rebuild" so cause errors. Make sure grant permissions for www-data:

    for FOLDER_NAME in \* a b c g guestbook k lit m min t test; do
        sudo chown -R www-data:www-data $FOLDER_NAME
    done
    2. When reinstalling a "theme" (plugin) does not resolve the issues, try uninstalling it first and then installing it. "Themes" would cause issues, especially when files do not exist (such as catalogue.html), so making it impossible to overwrite that files.
    3. There have been many more issues during the migration, but I am just recording some of them here. I guess if simply copy-paste all the files won't cause much issues. Just make sure the mysql database is sourced and connected.

     No.70

    >>68
    Yeah when I did it I just rsynced the whole folder. Also if you use mysqldump –all-databases it automatically dumps all users and tables. As I can remember the only thing you need to do further is to flush privileges. I found mysql much easier than postgresql when it comes to stuff like this.