Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
console
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
console
Commits
06c3388d
Commit
06c3388d
authored
Oct 26, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test interface
parent
1286459a
Pipeline
#17484
passed with stages
in 2 minutes and 21 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
console-api/src/update/update.controller.ts
console-api/src/update/update.controller.ts
+9
-1
console-api/src/update/update.service.ts
console-api/src/update/update.service.ts
+15
-0
No files found.
console-api/src/update/update.controller.ts
View file @
06c3388d
...
...
@@ -48,12 +48,20 @@ export class UpdateController {
@
Param
(
'
id
'
)
id
:
string
,
@
Query
(
new
ValidationPipe
({
transform
:
true
}))
depot
:
DepotDto
,
@
Param
(
'
version
'
)
version
:
string
,
@
Res
({
passthrough
:
true
})
res
:
Response
,
@
Ip
()
ip
:
string
)
{
return
this
.
updateService
.
getFullPackageMetalink
(
id
,
depot
,
version
,
ip
);
}
@
Get
(
'
single/:path
'
)
@
Render
(
'
metalinks
'
)
@
ApiOperation
({
summary
:
'
获取单个包 metalink
'
,
description
:
'
测试使用
'
})
@
ApiParam
({
name
:
'
path
'
,
description
:
'
路径
'
})
@
ApiOkResponse
({
type
:
String
})
async
getSinglePackageMetalink
(@
Param
(
'
path
'
)
path
:
string
,
@
Ip
()
ip
:
string
)
{
return
this
.
updateService
.
getSinglePackageMetalink
(
path
,
ip
);
}
@
Post
(
'
update/:id/:version
'
)
@
Render
(
'
metalinks
'
)
@
ApiOperation
({
summary
:
'
获取 app 部分包 metalink
'
,
description
:
'
根据文件返回需要下载什么文件
'
})
...
...
console-api/src/update/update.service.ts
View file @
06c3388d
...
...
@@ -138,6 +138,21 @@ export class UpdateService extends ConsoleLogger {
};
}
async
getSinglePackageMetalink
(
path
:
string
,
ip
:
string
)
{
const
archives
=
await
this
.
db
.
getRepository
(
Archive
).
find
({
where
:
{
path
},
select
:
[
'
hash
'
,
'
path
'
,
'
size
'
],
});
if
(
!
archives
.
length
)
{
throw
new
BlankReturnMessageDto
(
404
,
'
Archive not found
'
).
toException
();
}
await
this
.
mirror
.
lookForArchivesMirror
(
archives
,
ip
);
return
{
cdnUrl
:
this
.
cdnUrl
,
archives
,
};
}
async
getFullPackageMetalink
(
id
:
string
,
depotDto
:
DepotDto
,
version
:
string
,
ip
:
string
)
{
const
archives
=
await
this
.
getArchives
(
id
,
depotDto
,
version
,
(
qb
)
=>
qb
.
select
([
'
archive.hash
'
,
'
archive.path
'
,
'
archive.size
'
]).
andWhere
(
'
archive.role = :fullRole
'
,
{
fullRole
:
ArchiveType
.
Full
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment