From 04c3042030e53ef12bb6a9722b16c468aa964e4f Mon Sep 17 00:00:00 2001 From: azikx Date: Wed, 23 Oct 2024 19:10:54 +0900 Subject: [PATCH] =?UTF-8?q?update=20=EF=8C=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- home/programs/cli/yazi/default.nix | 59 ++--------- home/programs/misc/xdg.nix | 153 ++++++++++++++--------------- host/misc/default.nix | 2 +- host/misc/zapret.nix | 30 +++++- 4 files changed, 114 insertions(+), 130 deletions(-) diff --git a/home/programs/cli/yazi/default.nix b/home/programs/cli/yazi/default.nix index c794179..84ac8d0 100644 --- a/home/programs/cli/yazi/default.nix +++ b/home/programs/cli/yazi/default.nix @@ -24,65 +24,22 @@ in { max_width = 1000; }; opener = { + open = [{ run = "xdg-open $@"; }]; edit = [{ - run = ''hx "$@"''; + run = "hx $@"; block = true; }]; - play = [{ - run = "mpv $@"; - orphan = true; - }]; - reveal = [ - { - run = ''imv-dir "$@"''; - block = true; - } - { run = ''xdg-open "$(dirname "$0")"''; } - { - run = ''exiftool "$1"; echo "Press enter to exit"; read ''; - block = true; - } - ]; - audio = [ - { - run = ''mpv --no-video "$@"''; - block = true; - } - { - run = ''mediainfo "$1"; echo "Press enter to exit"; read''; - block = true; - } - ]; - video = [ - { - run = ''mpv "$@"''; - block = true; - } - { - run = ''mediainfo "$1"; echo "Press enter to exit"; read _''; - block = true; - } - ]; document = [{ desc = "Document"; orphan = true; run = "onlyoffice-desktopeditors"; }]; - open = [{ run = "xdg-open $@"; }]; }; open = { rules = [ - { - mime = "*"; - use = [ "edit" "reveal" ]; - } - { - mime = "*/"; - use = [ "edit" "open" "reveal" ]; - } { mime = "text/*"; - use = [ "edit" "reveal" ]; + use = "edit"; } { mime = "inode/x-empty"; @@ -93,12 +50,16 @@ in { use = [ "edit" "reveal" ]; } { - mime = "{audio,video}/*"; - use = [ "play" "reveal" ]; + mime = "video/*"; + use = "play"; + } + { + mime = "audio/*"; + use = "play"; } { mime = "image/*"; - use = [ "open" "reveal" ]; + use = "open"; } { mime = "application/vnd.openxmlformats-officedocument.*"; diff --git a/home/programs/misc/xdg.nix b/home/programs/misc/xdg.nix index 4ff8616..c61ce35 100644 --- a/home/programs/misc/xdg.nix +++ b/home/programs/misc/xdg.nix @@ -34,83 +34,82 @@ in { "application/x-shellscript" = "Helix.${ds}"; "application/x-docbook+xml" = "Helix.${ds}"; # IMAGE FORMATS - /* "image/avif" = "swayimg.${ds}"; - "image/gif" = "swayimg.${ds}"; - "image/heif" = "swayimg.${ds}"; - "image/jpg" = "swayimg.${ds}"; - "image/jpeg" = "swayimg.${ds}"; - "image/jxl" = "swayimg.${ds}"; - "image/png" = "swayimg.${ds}"; - "image/bmp" = "swayimg.${ds}"; - "image/x-eps" = "swayimg.${ds}"; - "image/x-icns" = "swayimg.${ds}"; - "image/x-ico" = "swayimg.${ds}"; - "image/x-portable-bitmap" = "swayimg.${ds}"; - "image/x-portable-graymap" = "swayimg.${ds}"; - "image/x-portable-swayimgmap" = "swayimg.${ds}"; - "image/x-xbitmap" = "swayimg.${ds}"; - "image/x-xswayimgmap" = "swayimg.${ds}"; - "image/tiff" = "swayimg.${ds}"; - "image/x-psd" = "swayimg.${ds}"; - "image/x-webp" = "swayimg.${ds}"; - "image/webp" = "swayimg.${ds}"; - "image/x-tga" = "swayimg.${ds}"; - "image/svg+xml" = "swayimg.${ds}"; - # VIDEO FORMATS - "video/3gp" = "mpv.${ds}"; - "video/3gpp" = "mpv.${ds}"; - "video/3gpp2" = "mpv.${ds}"; - "video/avi" = "mpv.${ds}"; - "video/divx" = "mpv.${ds}"; - "video/dv" = "mpv.${ds}"; - "video/fli" = "mpv.${ds}"; - "video/flv" = "mpv.${ds}"; - "video/mp2t" = "mpv.${ds}"; - "video/mp4" = "mpv.${ds}"; - "video/mp4v-es" = "mpv.${ds}"; - "video/mpeg" = "mpv.${ds}"; - "video/msvideo" = "mpv.${ds}"; - "video/ogg" = "mpv.${ds}"; - "video/quicktime" = "mpv.${ds}"; - "video/vnd.divx" = "mpv.${ds}"; - "video/vnd.mpegurl" = "mpv.${ds}"; - "video/vnd.rn-realvideo" = "mpv.${ds}"; - "video/webm" = "mpv.${ds}"; - "video/x-avi" = "mpv.${ds}"; - "video/x-flv" = "mpv.${ds}"; - "video/x-m4v" = "mpv.${ds}"; - "video/x-matroska" = "mpv.${ds}"; - "video/x-mpeg2" = "mpv.${ds}"; - "video/x-ms-asf" = "mpv.${ds}"; - "video/x-msvideo" = "mpv.${ds}"; - "video/x-ms-wmv" = "mpv.${ds}"; - "video/x-ms-wmx" = "mpv.${ds}"; - "video/x-ogm" = "mpv.${ds}"; - "video/x-ogm+ogg" = "mpv.${ds}"; - "video/x-theora" = "mpv.${ds}"; - "video/x-theora+ogg" = "mpv.${ds}"; - "application/x-matroska" = "mpv.${ds}"; - # AUDIO FORMATS - "audio/aac" = "mpv.${ds}"; - "audio/mp4" = "mpv.${ds}"; - "audio/mpeg" = "mpv.${ds}"; - "audio/mpegurl" = "mpv.${ds}"; - "audio/ogg" = "mpv.${ds}"; - "audio/vnd.rn-realaudio" = "mpv.${ds}"; - "audio/vorbis" = "mpv.${ds}"; - "audio/x-flac" = "mpv.${ds}"; - "audio/x-mp3" = "mpv.${ds}"; - "audio/x-mpegurl" = "mpv.${ds}"; - "audio/x-ms-wma" = "mpv.${ds}"; - "audio/x-musepack" = "mpv.${ds}"; - "audio/x-oggflac" = "mpv.${ds}"; - "audio/x-pn-realaudio" = "mpv.${ds}"; - "audio/x-scpls" = "mpv.${ds}"; - "audio/x-speex" = "mpv.${ds}"; - "audio/x-vorbis" = "mpv.${ds}"; - "audio/x-vorbis+ogg" = "mpv.${ds}"; - "audio/x-wav" = "mpv.${ds}"; - */ + "image/avif" = "swayimg.${ds}"; + "image/gif" = "swayimg.${ds}"; + "image/heif" = "swayimg.${ds}"; + "image/jpg" = "swayimg.${ds}"; + "image/jpeg" = "swayimg.${ds}"; + "image/jxl" = "swayimg.${ds}"; + "image/png" = "swayimg.${ds}"; + "image/bmp" = "swayimg.${ds}"; + "image/x-eps" = "swayimg.${ds}"; + "image/x-icns" = "swayimg.${ds}"; + "image/x-ico" = "swayimg.${ds}"; + "image/x-portable-bitmap" = "swayimg.${ds}"; + "image/x-portable-graymap" = "swayimg.${ds}"; + "image/x-portable-swayimgmap" = "swayimg.${ds}"; + "image/x-xbitmap" = "swayimg.${ds}"; + "image/x-xswayimgmap" = "swayimg.${ds}"; + "image/tiff" = "swayimg.${ds}"; + "image/x-psd" = "swayimg.${ds}"; + "image/x-webp" = "swayimg.${ds}"; + "image/webp" = "swayimg.${ds}"; + "image/x-tga" = "swayimg.${ds}"; + "image/svg+xml" = "swayimg.${ds}"; + # VIDEO FORMATS + "video/3gp" = "mpv.${ds}"; + "video/3gpp" = "mpv.${ds}"; + "video/3gpp2" = "mpv.${ds}"; + "video/avi" = "mpv.${ds}"; + "video/divx" = "mpv.${ds}"; + "video/dv" = "mpv.${ds}"; + "video/fli" = "mpv.${ds}"; + "video/flv" = "mpv.${ds}"; + "video/mp2t" = "mpv.${ds}"; + "video/mp4" = "mpv.${ds}"; + "video/mp4v-es" = "mpv.${ds}"; + "video/mpeg" = "mpv.${ds}"; + "video/msvideo" = "mpv.${ds}"; + "video/ogg" = "mpv.${ds}"; + "video/quicktime" = "mpv.${ds}"; + "video/vnd.divx" = "mpv.${ds}"; + "video/vnd.mpegurl" = "mpv.${ds}"; + "video/vnd.rn-realvideo" = "mpv.${ds}"; + "video/webm" = "mpv.${ds}"; + "video/x-avi" = "mpv.${ds}"; + "video/x-flv" = "mpv.${ds}"; + "video/x-m4v" = "mpv.${ds}"; + "video/x-matroska" = "mpv.${ds}"; + "video/x-mpeg2" = "mpv.${ds}"; + "video/x-ms-asf" = "mpv.${ds}"; + "video/x-msvideo" = "mpv.${ds}"; + "video/x-ms-wmv" = "mpv.${ds}"; + "video/x-ms-wmx" = "mpv.${ds}"; + "video/x-ogm" = "mpv.${ds}"; + "video/x-ogm+ogg" = "mpv.${ds}"; + "video/x-theora" = "mpv.${ds}"; + "video/x-theora+ogg" = "mpv.${ds}"; + "application/x-matroska" = "mpv.${ds}"; + # AUDIO FORMATS + "audio/aac" = "mpv.${ds}"; + "audio/mp4" = "mpv.${ds}"; + "audio/mpeg" = "mpv.${ds}"; + "audio/mpegurl" = "mpv.${ds}"; + "audio/ogg" = "mpv.${ds}"; + "audio/vnd.rn-realaudio" = "mpv.${ds}"; + "audio/vorbis" = "mpv.${ds}"; + "audio/x-flac" = "mpv.${ds}"; + "audio/x-mp3" = "mpv.${ds}"; + "audio/x-mpegurl" = "mpv.${ds}"; + "audio/x-ms-wma" = "mpv.${ds}"; + "audio/x-musepack" = "mpv.${ds}"; + "audio/x-oggflac" = "mpv.${ds}"; + "audio/x-pn-realaudio" = "mpv.${ds}"; + "audio/x-scpls" = "mpv.${ds}"; + "audio/x-speex" = "mpv.${ds}"; + "audio/x-vorbis" = "mpv.${ds}"; + "audio/x-vorbis+ogg" = "mpv.${ds}"; + "audio/x-wav" = "mpv.${ds}"; # WEB "text/html" = "zen.${ds}"; "x-scheme-handler/ftp" = "zen.${ds}"; diff --git a/host/misc/default.nix b/host/misc/default.nix index c0aa18a..fda2b65 100644 --- a/host/misc/default.nix +++ b/host/misc/default.nix @@ -7,6 +7,6 @@ ./security.nix ./user.nix - ./zapret.nix + # ./zapret.nix ]; } diff --git a/host/misc/zapret.nix b/host/misc/zapret.nix index adb801f..22c875e 100644 --- a/host/misc/zapret.nix +++ b/host/misc/zapret.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, config, ... }: { +{ pkgs, ... }: { systemd.services.zapret = { # ZAPRET FOR YOTUBE after = [ "network-online.target" ]; wants = [ "network-online.target" ]; @@ -13,8 +13,32 @@ GuessMainPID = "no"; ExecStart = "${pkgs.zapret}/bin/zapret start"; ExecStop = "${pkgs.zapret}/bin/zapret stop"; - EnvironmentFile = pkgs.writeText "zapret-environment" - " FWTYPE=\"iptables\"\n SET_MAXELEM=522288\n IPSET_OPT=\"hashsize 262144 maxelem $SET_MAXELEM\"\n AUTOHOSTLIST_RETRANS_THRESHOLD=3\n AUTOHOSTLIST_FAIL_THRESHOLD=3\n AUTOHOSTLIST_FAIL_TIME=60\n AUTOHOSTLIST_DEBUGLOG=0\n MDIG_THREADS=30\n GZIP_LISTS=1\n\n MODE=nfqws\n MODE_HTTP=1\n MODE_HTTP_KEEPALIVE=0\n MODE_HTTPS=1\n MODE_QUIC=0\n MODE_FILTER=none\n\n DESYNC_MARK=0x40000000\n DESYNC_MARK_POSTNAT=0x20000000\n NFQWS_OPT_DESYNC=\"--dpi-desync=fake,split2 --dpi-desync-ttl=3\"\n TPWS_OPT=\"--hostspell=HOST --split-http-req=method --split-pos=3 --oob\"\n FLOWOFFLOAD=donttouch\n INIT_APPLY_FW=1\n DISABLE_IPV6=0\n"; + EnvironmentFile = pkgs.writeText "zapret-environment" '' + FWTYPE="iptables" + SET_MAXELEM=522288 + IPSET_OPT="hashsize 262144 maxelem $SET_MAXELEM" + AUTOHOSTLIST_RETRANS_THRESHOLD=3 + AUTOHOSTLIST_FAIL_THRESHOLD=3 + AUTOHOSTLIST_FAIL_TIME=60 + AUTOHOSTLIST_DEBUGLOG=0 + MDIG_THREADS=30 + GZIP_LISTS=1 + + MODE=nfqws + MODE_HTTP=1 + MODE_HTTP_KEEPALIVE=0 + MODE_HTTPS=1 + MODE_QUIC=0 + MODE_FILTER=none + + DESYNC_MARK=0x40000000 + DESYNC_MARK_POSTNAT=0x20000000 + NFQWS_OPT_DESYNC="--dpi-desync=fake --dpi-desync-ttl=9" # EDIT THIS + TPWS_OPT="--hostspell=HOST --split-http-req=method --split-pos=3 --oob" + FLOWOFFLOAD=donttouch + INIT_APPLY_FW=1 + DISABLE_IPV6=0 + ''; }; }; }