1.1.4.15 -> 1.1.4.16 第1次更新

This commit is contained in:
Sving1024 2025-05-03 16:40:58 +08:00 committed by Space Time
parent 77b75dedca
commit 8d27589aa1
2 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,24 @@
import json
import toml
from collections import defaultdict
def convert_host_to_toml(host_path, toml_path):
with open(host_path) as host_file:
host_rules = json.load(host_file)
toml_rules = defaultdict(dict)
for host_rule in host_rules:
domains, sni, ip = host_rule
for domain in domains:
toml_rules["alter_hostname"][domain] = sni
toml_rules["hosts"][domain] = ip
with open(toml_path, "w") as toml_file:
toml.dump(toml_rules, toml_file)
if __name__ == "__main__":
convert_host_to_toml("Cealing-Host.json", "Cealing-Host.toml")

View File

@ -0,0 +1,38 @@
name: Convert Host To Toml
on:
release:
types: [published]
jobs:
convert_host_to_toml:
name: Convert Host To Toml
runs-on: ubuntu-latest
steps:
- name: Fetch Github Folder & Host
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
Cealing-Host.json
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x
check-latest: true
- name: Install Toml
run: pip install "toml"
- name: Convert Host To Toml
run: |
cp "Cealing-Host.json" ".github/workflows/Cealing-Host.json"
cd ".github/workflows"
python "convert_host_to_toml.py"
- name: Release Toml
uses: softprops/action-gh-release@v2
with:
files: Cealing-Host.toml
token: ${{ secrets.GH_TOKEN }}