Skip to content

Commit 5607778

Browse files
authored
Merge pull request #302 from AmiyaBot/V6-dev
V6 dev
2 parents df1fee7 + 6f4237c commit 5607778

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

.github/publish.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v6.5.7
1+
v6.5.8

.github/workflows/package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ jobs:
5555
with:
5656
context: .
5757
push: true
58-
tags: amiyabot/amiyabot:2.0.2, amiyabot/amiyabot:latest
58+
tags: amiyabot/amiyabot:6.5.8, amiyabot/amiyabot:latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ config/cos.yaml
1515
config/remote.yaml
1616
config/penetration.yaml
1717
main*.py
18+
start.zsh
1819

1920
*.pyc
2021
*.spec

core/config/remote.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
1+
import requests
12
from dataclasses import dataclass, field
23
from core.util import init_config_file
34

45

56
@dataclass
67
class Remote:
78
cos: str = 'https://cos.amiyabot.com'
8-
plugin: str = 'https://server.amiyabot.com:10001'
9+
plugin: str = 'https://cdn.amiyabot.com'
910
console: str = 'http://106.52.139.57:8000'
11+
12+
def __init__(self):
13+
try:
14+
res = requests.get(f'{self.plugin}/api/v1/remote')
15+
data = res.json()
16+
if res.status_code != 200 or not 'code' in data:
17+
return
18+
if data['code'] == 200:
19+
self.cos = data['data']['cos']
20+
self.plugin = data['data']['plugin']
21+
self.console = data['data']['console']
22+
except:
23+
pass
1024

1125

1226
@dataclass
@@ -15,7 +29,7 @@ class RemoteConfig:
1529

1630

1731
def init(file: str) -> RemoteConfig:
18-
return init_config_file(file, RemoteConfig)
32+
return init_config_file(file, RemoteConfig, True)
1933

2034

2135
remote_config = init('config/remote.yaml')

core/util/yamlManager.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ def create_yaml(cls, path: str, data: dict, overwrite: bool = False):
4444
return True
4545

4646

47-
def init_config_file(file: str, build_cls):
47+
def init_config_file(file: str, build_cls, refresh=False):
4848
config = {}
4949
if os.path.exists(file):
50-
config = YamlManager.read_yaml(file, _dict=True)
50+
config = YamlManager.read_yaml(file, _dict=True, _refresh=refresh)
5151

52-
YamlManager.create_yaml(file, merge_dict(config, asdict(build_cls())), True)
52+
if not refresh:
53+
YamlManager.create_yaml(file, merge_dict(config, asdict(build_cls())), True)
54+
else:
55+
YamlManager.create_yaml(file, asdict(build_cls()), True)
5356
return YamlManager.read_yaml(file)

0 commit comments

Comments
 (0)