mirror of
https://github.com/ACL4SSR/ACL4SSR.git
synced 2026-06-09 14:02:32 +00:00
fix some bugs
This commit is contained in:
9
.github/workflows/update.yml
vendored
9
.github/workflows/update.yml
vendored
@@ -114,12 +114,19 @@ jobs:
|
||||
# 清理临时文件
|
||||
rm -f Clash/Providers/*_domain.yaml Clash/Providers/*_ip.yaml
|
||||
rm -f Clash/Ruleset/*_domain.list Clash/Ruleset/*_ip.list
|
||||
# 清理 mihomo 二进制文件
|
||||
rm -f mihomo
|
||||
echo "Temporary files cleaned up"
|
||||
|
||||
- name: Get current datetime
|
||||
id: datetime
|
||||
run: echo "datetime=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Commit and push changes
|
||||
uses: EndBug/add-and-commit@v9
|
||||
with:
|
||||
message: '[AutoUpdate] Update GFWList rules and mrs files - $(date -u +"%Y-%m-%dT%H:%M:%SZ")'
|
||||
message: '[AutoUpdate] Update GFWList rules and mrs files - ${{ env.DATETIME }}'
|
||||
push: true
|
||||
env:
|
||||
DATETIME: ${{ steps.datetime.outputs.datetime }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -278,6 +278,49 @@ def main():
|
||||
print(f"IP blacklist entries: {len(ip_blacklist)}")
|
||||
print(f"IP whitelist entries: {len(ip_whitelist)}")
|
||||
|
||||
existing_unban_domains = []
|
||||
existing_unban_ips = []
|
||||
|
||||
if os.path.exists('Clash/Providers/UnBan.yaml'):
|
||||
with open('Clash/Providers/UnBan.yaml', 'r', encoding='utf-8') as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if line.startswith('- DOMAIN-SUFFIX,'):
|
||||
existing_unban_domains.append(line.replace('- DOMAIN-SUFFIX,', '', 1))
|
||||
elif line.startswith('- IP-CIDR') or line.startswith(' - IP-CIDR'):
|
||||
parts = line.replace(' - ', '').split(',')
|
||||
if len(parts) >= 2:
|
||||
existing_unban_ips.append(parts[1])
|
||||
|
||||
if os.path.exists('Clash/Ruleset/UnBan.list'):
|
||||
with open('Clash/Ruleset/UnBan.list', 'r', encoding='utf-8') as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if line.startswith('DOMAIN-SUFFIX,'):
|
||||
existing_unban_domains.append(line.replace('DOMAIN-SUFFIX,', '', 1))
|
||||
elif line.startswith('IP-CIDR'):
|
||||
parts = line.split(',')
|
||||
if len(parts) >= 2:
|
||||
existing_unban_ips.append(parts[1])
|
||||
|
||||
if existing_unban_domains:
|
||||
new_count = 0
|
||||
for d in existing_unban_domains:
|
||||
if d and d not in domain_whitelist:
|
||||
domain_whitelist.append(d)
|
||||
new_count += 1
|
||||
if new_count > 0:
|
||||
print(f"Merged {new_count} existing UnBan domains")
|
||||
|
||||
if existing_unban_ips:
|
||||
new_count = 0
|
||||
for ip in existing_unban_ips:
|
||||
if ip and ip not in ip_whitelist:
|
||||
ip_whitelist.append(ip)
|
||||
new_count += 1
|
||||
if new_count > 0:
|
||||
print(f"Merged {new_count} existing UnBan IPs")
|
||||
|
||||
generate_acl_file(domain_blacklist, ip_blacklist, 'Acl/fullgfwlist.acl', "GFWList Blacklist")
|
||||
print("Generated: Acl/fullgfwlist.acl")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user