mirror of
https://github.com/SpaceTimee/Cealing-Host.git
synced 2025-07-13 21:02:39 +08:00
1.1.4.15 -> 1.1.4.16 第1次更新
This commit is contained in:
parent
77b75dedca
commit
8d27589aa1
24
.github/workflows/convert_host_to_toml.py
vendored
Normal file
24
.github/workflows/convert_host_to_toml.py
vendored
Normal 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")
|
38
.github/workflows/convert_host_to_toml.yaml
vendored
Normal file
38
.github/workflows/convert_host_to_toml.yaml
vendored
Normal 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 }}
|
Loading…
Reference in New Issue
Block a user