From dfa21385f381cd2b21b37f5b6f1a6ce8c7dde8b5 Mon Sep 17 00:00:00 2001 From: Morgan Jeon Date: Tue, 10 Oct 2023 00:09:29 +0900 Subject: [PATCH 1/4] removed test things --- pub/form.html | 2 +- scripts/config.yml | 22 +++++++++++----------- scripts/getFetch.py | 2 -- scripts/sync.sh | 6 +++--- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/pub/form.html b/pub/form.html index d22785b..edde506 100644 --- a/pub/form.html +++ b/pub/form.html @@ -58,7 +58,7 @@ formData.append('title', title); formData.append('content', content); - fetch(PUSHNOTIFICAATIONURL, { + fetch(PUSHAPIADDRESS, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', diff --git a/scripts/config.yml b/scripts/config.yml index 82fa3e3..f4637aa 100644 --- a/scripts/config.yml +++ b/scripts/config.yml @@ -28,28 +28,28 @@ global: repos: ARCHLINUX: url: rsync://mirrors.xtom.de/archlinux/ - duration: 4 + delay: 4 name: "ArchLinux (x86_64)" path: archlinux log: ./logs/archlinux last_sync: "2023-10-09T23:48Z" UBUNTU: url: rsync://rsync.archive.ubuntu.com/ubuntu/ - duration: 4 + delay: 4 name: "Ubuntu" path: ubuntu log: ./logs/ubuntu last_sync: "2023-10-09T23:48Z" UBUNTU_CD: url: rsync://releases.ubuntu.com/releases/ - duration: 24 + delay: 24 name: "Ubuntu Releases" path: ubuntu_cd log: ./logs/ubuntu_cd last_sync: "2023-10-09T23:48Z" UBUNTU_CD_OLD: url: rsync://old-releases.ubuntu.com/releases/ - duration: 24 + delay: 24 name: "Ubuntu Releases (Old)" path: ubuntu_cd_old log: ./logs/ubuntu_cd_old @@ -57,7 +57,7 @@ repos: DEBIAN: url: rsync://mirrors.xtom.jp/debian/ type: ftpsync - duration: 4 + delay: 4 name: Debian path: debian scripts: @@ -65,28 +65,28 @@ repos: last_sync: "2023-10-09T23:48Z" DEBIAN_CD: url: rsync://ftp.lanet.kr/debian-cd/ - duration: 24 + delay: 24 name: "Debian CD" path: debian_cd log: ./logs/debian_cd last_sync: "2023-10-09T23:48Z" FEDORA: url: rsync://dl.fedoraproject.org/fedora-enchilada/linux/ - duration: 4 + delay: 4 name: "Fedora" path: fedora log: ./logs/fedora last_sync: "2023-10-09T23:30Z" RASPBIAN: url: rsync://archive.raspbian.org/archive/ - duration: 6 + delay: 6 name: "Raspbian" path: raspbian log: ./logs/raspbian last_sync: "2023-10-09T23:30Z" MANJARO: url: rsync://ftp.riken.jp/manjaro/ - duration: 4 + delay: 4 name: Manjaro path: manjaro log: ./logs/manjaro @@ -96,14 +96,14 @@ repos: path: archlinuxarm url: http://jp.mirror.archlinuxarm.org/ type: http - duration: 12 + delay: 12 last_sync: "2023-10-09T23:30Z" ASAHILINUX: name: "AsahiLinux" path: asahilinux url: https://cdn.asahilinux.org/ type: http - duration: 12 + delay: 12 last_sync: "2023-10-09T23:30Z" index: - ARCHLINUX diff --git a/scripts/getFetch.py b/scripts/getFetch.py index 1b881c0..4360d84 100644 --- a/scripts/getFetch.py +++ b/scripts/getFetch.py @@ -53,8 +53,6 @@ if __name__ == "__main__": print("Usage: createFetch.py [URL] [Path] (fetch)") sys.exit() - # urls = {"archlinuxarm": "http://jp.mirror.archlinuxarm.org/", "asahilinux": "https://cdn.asahilinux.org/", "linux-surface": "https://pkg.surfacelinux.com/arch/"} - if "http" in sys.argv[1]: if input(f"[*] Download from {sys.argv[1]}? ") in "Yy": url = sys.argv[1] diff --git a/scripts/sync.sh b/scripts/sync.sh index 9599a23..29bae8f 100755 --- a/scripts/sync.sh +++ b/scripts/sync.sh @@ -110,10 +110,10 @@ if [[ "${repos[0]}" == "ALL" ]]; then fi for repo in "${repos[@]}"; do echo Checking $repo... - duration=$(parse_yaml "repos.${repo}.duration") + delay=$(parse_yaml "repos.${repo}.delay") last_sync_timestamp=$(date -d "$(parse_yaml "repos.${repo}.last_sync")" +%s) - next_sync_timestamp=$(( last_sync_timestamp + duration * 3600 )) - next_sync_timestamp=1 + next_sync_timestamp=$(( last_sync_timestamp + delay * 3600 )) + if [ $next_sync_timestamp -le $(date +%s) ]; then echo "Lastsync $last_sync_timestamp" echo "Syncing $repo..." From 16dd38ad224fa10bbed00e5539e1714653a7dcc9 Mon Sep 17 00:00:00 2001 From: Morgan Date: Tue, 10 Oct 2023 00:20:37 +0900 Subject: [PATCH 2/4] Create README.md --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..02a9e21 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +## PAWE.ME +Simple mirroring & archiving server. + +- This script is used to serve ![pawe.me](https://pawe.me) mirroring server. + +- config.yaml contains various config options, can add more repo/upstream with just adding to config. supports http, rsync, ftpsync(debian). + +- ~~HTTP Mirroring uses custom python script using aiohttp, may change to wget recursive mirroring..~~ fixing script, currently just fetches in order. + +- $BASE_DIR is where all data is stored. Need to change manually in script index.py + +- index.py renders index.html file after each sync, order and half-size card can be configured in config.yml From 32b9a9df7df0f6c28515ee2fc45af14b090e7458 Mon Sep 17 00:00:00 2001 From: Morgan Date: Tue, 10 Oct 2023 00:21:10 +0900 Subject: [PATCH 3/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 02a9e21..6293022 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## PAWE.ME Simple mirroring & archiving server. -- This script is used to serve ![pawe.me](https://pawe.me) mirroring server. +- This script is used to serve [pawe.me](https://pawe.me) mirroring server. - config.yaml contains various config options, can add more repo/upstream with just adding to config. supports http, rsync, ftpsync(debian). From 304832e57d837441cb1251dfe5a264ca1618b815 Mon Sep 17 00:00:00 2001 From: Morgan Date: Tue, 10 Oct 2023 00:24:06 +0900 Subject: [PATCH 4/4] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6293022..4a5fc1e 100644 --- a/README.md +++ b/README.md @@ -8,5 +8,7 @@ Simple mirroring & archiving server. - ~~HTTP Mirroring uses custom python script using aiohttp, may change to wget recursive mirroring..~~ fixing script, currently just fetches in order. - $BASE_DIR is where all data is stored. Need to change manually in script index.py - + - index.py renders index.html file after each sync, order and half-size card can be configured in config.yml + +- element DIVIDER in .index (from config) is used to divide card between "main" and "additional mirroring" in index.html