luciopaiva / witchcraft

Inject Javascript and CSS right from your file system. Think GreaseMonkey for more advanced users.
https://luciopaiva.com/witchcraft
MIT License
254 stars 18 forks source link

Chrome Web Server Alternatives #60

Open willpercey-gb opened 1 year ago

willpercey-gb commented 1 year ago

I thought I'd raise this as the documentation specifies to use Chrome Web Server.

Since Chrome Web Server has now been shutdown, there are some other alternatives people can use.

My personal preference: Docker docker run -it -d -p 5743:80 --restart unless-stopped --name witchcraft -v ~/witchcraft-scripts:/usr/share/nginx/html nginx

Then as long as docker is running it'll always work.

Alternatively npm's http-server cd witchcraft-scripts && http-server -p 5743

gbdematos commented 8 months ago

I use https://github.com/TheWaWaR/simple-http-server and https://github.com/winsw/winsw.

<service>
  <id>witchcraft-server</id>
  <executable>server</executable>
  <arguments>--nocache "D:\GoogleDrive\Dev\witchcraft" -p 5743</arguments>
  <log mode="none"></log>
</service>
Ashus commented 8 months ago

I just use a nginx, here is a config for windows:

error_log NUL crit;
pid z:/temp/witchcraft-nginx.pid;

worker_processes  1;
events {
    worker_connections  512;
}

http {
    access_log off;

    client_body_temp_path z:/temp 1 2;
    proxy_temp_path z:/temp 1 2;
    fastcgi_temp_path z:/temp 1 2;
    uwsgi_temp_path z:/temp 1 2;
    scgi_temp_path z:/temp 1 2;

    include mime.types;
    default_type application/octet-stream;
    charset utf-8;

    sendfile        on;

    keepalive_timeout  60;

    server {
        listen       127.0.0.1:5743;
        server_name  witchcraft;

        location / {
            root   ../Witchcraft-mods;
            index  html/index.html;

            expires 10s;
            add_header Cache-Control "private";
        }
    }
}

You just need to replace the z:/temp with your temporary dir as nginx config doesn't support environment variables.

MijoBarbaric commented 7 months ago

https://simplewebserver.org/docs/wsc.html

edbrannin commented 6 months ago

If you have NodeJS installed, you can use browser-sync:

#!/bin/bash
npx browser-sync start --server --files --watch --directory --port 5743 --no-open --listen 127.0.0.1 .

Edit: Add --no-open and --listen 127.0.0.1