Compare commits

...

3 Commits

Author SHA1 Message Date
viletyy e2835f7c59 force_flag缺失 2024-06-24 19:57:50 +08:00
viletyy 9da27ce977 check_addr移除 2024-06-21 21:12:01 +08:00
yystopf d906ee6c55 移除静态资源挂载 2024-06-12 09:04:10 +08:00
4 changed files with 15 additions and 15 deletions

View File

@ -25,7 +25,7 @@ app.include_router(LOG)
app.include_router(AUTH) app.include_router(AUTH)
app.include_router(SYNC_CONFIG) app.include_router(SYNC_CONFIG)
app.mount("/", StaticFiles(directory="web/dist"), name="static") # app.mount("/", StaticFiles(directory="web/dist"), name="static")
if __name__ == '__main__': if __name__ == '__main__':
# workers 参数仅在命令行使用uvicorn启动时有效 或使用环境变量 WEB_CONCURRENCY # workers 参数仅在命令行使用uvicorn启动时有效 或使用环境变量 WEB_CONCURRENCY

View File

@ -38,11 +38,11 @@ class SyncDirection(Controller):
dto: SyncRepoDTO = Body(..., description="绑定同步仓库信息") dto: SyncRepoDTO = Body(..., description="绑定同步仓库信息")
): ):
api_log(LogType.INFO, f"用户 {user} 使用 POST 方法访问接口 {request.url.path} ", user) api_log(LogType.INFO, f"用户 {user} 使用 POST 方法访问接口 {request.url.path} ", user)
if not base.check_addr(dto.external_repo_address) or not base.check_addr(dto.internal_repo_address): # if not base.check_addr(dto.external_repo_address) or not base.check_addr(dto.internal_repo_address):
return SYNCResponse( # return SYNCResponse(
code_status=Status.REPO_ADDR_ILLEGAL.code, # code_status=Status.REPO_ADDR_ILLEGAL.code,
msg=Status.REPO_ADDR_ILLEGAL.msg # msg=Status.REPO_ADDR_ILLEGAL.msg
) # )
if dto.sync_granularity not in [1, 2]: if dto.sync_granularity not in [1, 2]:
return SYNCResponse(code_status=Status.SYNC_GRAN_ILLEGAL.code, msg=Status.SYNC_GRAN_ILLEGAL.msg) return SYNCResponse(code_status=Status.SYNC_GRAN_ILLEGAL.code, msg=Status.SYNC_GRAN_ILLEGAL.msg)

View File

@ -139,7 +139,7 @@ def outer_to_inter(repo, branch, log_name: str, user: str, force_flag):
async def sync_repo_task(repo, user, force_flag): async def sync_repo_task(repo, user, force_flag):
if repo.sync_granularity == SyncType.one: if repo.sync_granularity == SyncType.one:
branches = await sync_branch_dao.sync_branch(repo_id=repo.id) branches = await sync_branch_dao.sync_branch(repo_id=repo.id)
await sync_branch_task(repo, branches, repo.sync_direction, user) await sync_branch_task(repo, branches, repo.sync_direction, user, force_flag)
else: else:
log_name = f'sync_{repo.repo_name}.log' log_name = f'sync_{repo.repo_name}.log'
try: try:

View File

@ -112,14 +112,14 @@ class SyncService(Service):
if repo is None: if repo is None:
return SYNCException(Status.REPO_NOTFOUND) return SYNCException(Status.REPO_NOTFOUND)
update_fields = {} update_fields = {}
if dto.internal_repo_address is not None: # if dto.internal_repo_address is not None:
if not base.check_addr(dto.internal_repo_address): # if not base.check_addr(dto.internal_repo_address):
return SYNCException(Status.REPO_ADDR_ILLEGAL) # return SYNCException(Status.REPO_ADDR_ILLEGAL)
update_fields['internal_repo_address'] = dto.internal_repo_address update_fields['internal_repo_address'] = dto.internal_repo_address
if dto.external_repo_address is not None: # if dto.external_repo_address is not None:
if not base.check_addr(dto.external_repo_address): # if not base.check_addr(dto.external_repo_address):
return SYNCException(Status.REPO_ADDR_ILLEGAL) # return SYNCException(Status.REPO_ADDR_ILLEGAL)
update_fields['external_repo_address'] = dto.external_repo_address update_fields['external_repo_address'] = dto.external_repo_address
if dto.inter_token is not None: if dto.inter_token is not None:
update_fields['inter_token'] = dto.inter_token update_fields['inter_token'] = dto.inter_token
if dto.exter_token is not None: if dto.exter_token is not None: