Add: AppAsarUpdate and GitOverCdn

This commit is contained in:
LmeSzinc 2023-09-10 02:10:57 +08:00
parent 3397869195
commit 49f4b9618e
9 changed files with 46 additions and 8 deletions

View File

@ -157,6 +157,9 @@ Deploy:
# '["alas"]' specified "alas" config # '["alas"]' specified "alas" config
# '["alas","alas2"]' specified "alas" "alas2" configs # '["alas","alas2"]' specified "alas" "alas2" configs
Run: null Run: null
# To update app.asar
# [In most cases] true
AppAsarUpdate: true
# --no-sandbox. https://github.com/electron/electron/issues/30966 # --no-sandbox. https://github.com/electron/electron/issues/30966
# Some Windows systems cannot call the GPU normally for virtualization, and you need to manually turn off sandbox mode # Some Windows systems cannot call the GPU normally for virtualization, and you need to manually turn off sandbox mode
NoSandbox: false NoSandbox: false

View File

@ -157,6 +157,9 @@ Deploy:
# '["alas"]' specified "alas" config # '["alas"]' specified "alas" config
# '["alas","alas2"]' specified "alas" "alas2" configs # '["alas","alas2"]' specified "alas" "alas2" configs
Run: null Run: null
# To update app.asar
# [In most cases] true
AppAsarUpdate: true
# --no-sandbox. https://github.com/electron/electron/issues/30966 # --no-sandbox. https://github.com/electron/electron/issues/30966
# Some Windows systems cannot call the GPU normally for virtualization, and you need to manually turn off sandbox mode # Some Windows systems cannot call the GPU normally for virtualization, and you need to manually turn off sandbox mode
NoSandbox: false NoSandbox: false

View File

@ -48,8 +48,8 @@ class AppManager(DeployConfig):
def app_update(self): def app_update(self):
logger.hr(f'Update app', 0) logger.hr(f'Update app', 0)
if not self.AutoUpdate: if not self.AppAsarUpdate:
logger.info('AutoUpdate is disabled, skip') logger.info('AppAsarUpdate is disabled, skip')
Progress.UpdateAlasApp() Progress.UpdateAlasApp()
return False return False

View File

@ -55,13 +55,18 @@ class ConfigModel:
# Webui # Webui
WebuiHost: str = "0.0.0.0" WebuiHost: str = "0.0.0.0"
WebuiPort: int = 22267 WebuiPort: int = 22367
Language: str = "en-US" Language: str = "en-US"
Theme: str = "default" Theme: str = "default"
DpiScaling: bool = True DpiScaling: bool = True
Password: Optional[str] = None Password: Optional[str] = None
CDN: Union[str, bool] = False CDN: Union[str, bool] = False
Run: Optional[str] = None Run: Optional[str] = None
AppAsarUpdate: bool = True
NoSandbox: bool = True
# Dynamic
GitOverCdn: bool = False
class DeployConfig(ConfigModel): class DeployConfig(ConfigModel):
@ -75,6 +80,13 @@ class DeployConfig(ConfigModel):
self.config_template = {} self.config_template = {}
self.read() self.read()
self.GitOverCdn = self.Repository in ['cn']
if self.Repository in [
'cn',
'global',
]:
self.Repository = 'https://github.com/LmeSzinc/StarRailCopilot'
self.write() self.write()
self.show_config() self.show_config()

View File

@ -157,6 +157,9 @@ Deploy:
# '["alas"]' specified "alas" config # '["alas"]' specified "alas" config
# '["alas","alas2"]' specified "alas" "alas2" configs # '["alas","alas2"]' specified "alas" "alas2" configs
Run: null Run: null
# To update app.asar
# [In most cases] true
AppAsarUpdate: true
# --no-sandbox. https://github.com/electron/electron/issues/30966 # --no-sandbox. https://github.com/electron/electron/issues/30966
# Some Windows systems cannot call the GPU normally for virtualization, and you need to manually turn off sandbox mode # Some Windows systems cannot call the GPU normally for virtualization, and you need to manually turn off sandbox mode
NoSandbox: false NoSandbox: false

View File

@ -504,6 +504,22 @@ class ConfigGenerator:
# update('template-docker', docker) # update('template-docker', docker)
# update('template-docker-cn', docker, cn) # update('template-docker-cn', docker, cn)
tpl = {
'Repository': '{{repository}}',
'GitExecutable': '{{gitExecutable}}',
'PythonExecutable': '{{pythonExecutable}}',
'AdbExecutable': '{{adbExecutable}}',
'Language': '{{language}}',
'Theme': '{{theme}}',
}
def update(file, *args):
new = deepcopy(template)
for dic in args:
new.update(dic)
poor_yaml_write(data=new, file=file)
update('./webapp/packages/main/public/deploy.yaml.tpl', tpl)
def insert_assignment(self): def insert_assignment(self):
from tasks.assignment.keywords import AssignmentEntry from tasks.assignment.keywords import AssignmentEntry
assignments = [entry.name for entry in AssignmentEntry.instances.values()] assignments = [entry.name for entry in AssignmentEntry.instances.values()]

View File

@ -1,8 +1,8 @@
Deploy: Deploy:
Git: Git:
# URL of AzurLaneAutoScript repository # URL of AzurLaneAutoScript repository
# [CN user] Use 'git://git.lyoko.io/AzurLaneAutoScript' for faster and more stable download # [CN user] Use 'cn' to get update from git-over-cdn service
# [Other] Use 'https://github.com/LmeSzinc/AzurLaneAutoScript' # [Other] Use 'global' to get update from https://github.com/LmeSzinc/StarRailCopilot
Repository: {{repository}} Repository: {{repository}}
# Branch of Alas # Branch of Alas
# [Developer] Use 'dev', 'app', etc, to try new features # [Developer] Use 'dev', 'app', etc, to try new features
@ -128,8 +128,8 @@ Deploy:
WebuiHost: 0.0.0.0 WebuiHost: 0.0.0.0
# --port. Port to listen # --port. Port to listen
# You will be able to access webui via `http://{host}:{port}` # You will be able to access webui via `http://{host}:{port}`
# [In most cases] Default to 22267 # [In most cases] Default to 22367
WebuiPort: 22267 WebuiPort: 22367
# Language to use on web ui # Language to use on web ui
# 'zh-CN' for Chinese simplified # 'zh-CN' for Chinese simplified
# 'en-US' for English # 'en-US' for English

View File

@ -9,6 +9,6 @@ export async function initAppConfigStore() {
appStore.setRepository( appStore.setRepository(
(repositoryValueMap[config?.repository] as 'global' | 'china') ?? 'global', (repositoryValueMap[config?.repository] as 'global' | 'china') ?? 'global',
); );
appStore.setWebuiUrl(config?.webuiUrl ?? '127.0.0.1:22267'); appStore.setWebuiUrl(config?.webuiUrl ?? '127.0.0.1:22367');
appStore.setAlasPath(config?.alasPath ?? ''); appStore.setAlasPath(config?.alasPath ?? '');
} }

View File

@ -64,6 +64,7 @@ declare interface DefAlasConfig {
Password: null | string; Password: null | string;
CDN: boolean; CDN: boolean;
Run: null | string; Run: null | string;
AppAsarUpdate: boolean;
NoSandbox: boolean; NoSandbox: boolean;
}; };
}; };