diff --git a/server/docs/docs.go b/server/docs/docs.go
index 86ece71..475c9a4 100644
--- a/server/docs/docs.go
+++ b/server/docs/docs.go
@@ -193,11 +193,6 @@ var doc = `{
},
"/api/v1/download/icon/{uuid}": {
"get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
"produces": [
"application/json"
],
@@ -259,18 +254,69 @@ var doc = `{
},
"/api/v1/download/mobileConfig/{uuid}": {
"get": {
- "security": [
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Download"
+ ],
+ "summary": "下载mobileconfig服务",
+ "parameters": [
{
- "ApiKeyAuth": []
+ "type": "string",
+ "description": "uuid",
+ "name": "uuid",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/api.Response"
+ }
+ }
+ }
+ }
+ },
+ "/api/v1/download/plist/{uuid}": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Download"
+ ],
+ "summary": "下载Plist服务",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "uuid",
+ "name": "uuid",
+ "in": "path",
+ "required": true
}
],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/api.Response"
+ }
+ }
+ }
+ }
+ },
+ "/api/v1/download/tempipa/{uuid}": {
+ "get": {
"produces": [
"application/json"
],
"tags": [
"Download"
],
- "summary": "下载mobileconfig服务",
+ "summary": "下载TempIPA服务",
"parameters": [
{
"type": "string",
diff --git a/server/docs/swagger.json b/server/docs/swagger.json
index 6bd69c8..cea8d9d 100644
--- a/server/docs/swagger.json
+++ b/server/docs/swagger.json
@@ -175,11 +175,6 @@
},
"/api/v1/download/icon/{uuid}": {
"get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
"produces": [
"application/json"
],
@@ -241,18 +236,69 @@
},
"/api/v1/download/mobileConfig/{uuid}": {
"get": {
- "security": [
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Download"
+ ],
+ "summary": "下载mobileconfig服务",
+ "parameters": [
{
- "ApiKeyAuth": []
+ "type": "string",
+ "description": "uuid",
+ "name": "uuid",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/api.Response"
+ }
+ }
+ }
+ }
+ },
+ "/api/v1/download/plist/{uuid}": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Download"
+ ],
+ "summary": "下载Plist服务",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "uuid",
+ "name": "uuid",
+ "in": "path",
+ "required": true
}
],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/api.Response"
+ }
+ }
+ }
+ }
+ },
+ "/api/v1/download/tempipa/{uuid}": {
+ "get": {
"produces": [
"application/json"
],
"tags": [
"Download"
],
- "summary": "下载mobileconfig服务",
+ "summary": "下载TempIPA服务",
"parameters": [
{
"type": "string",
diff --git a/server/docs/swagger.yaml b/server/docs/swagger.yaml
index ea2c25b..e5902d6 100644
--- a/server/docs/swagger.yaml
+++ b/server/docs/swagger.yaml
@@ -155,8 +155,6 @@ paths:
description: OK
schema:
$ref: '#/definitions/api.Response'
- security:
- - ApiKeyAuth: []
summary: 下载icon服务
tags:
- Download
@@ -195,11 +193,45 @@ paths:
description: OK
schema:
$ref: '#/definitions/api.Response'
- security:
- - ApiKeyAuth: []
summary: 下载mobileconfig服务
tags:
- Download
+ /api/v1/download/plist/{uuid}:
+ get:
+ parameters:
+ - description: uuid
+ in: path
+ name: uuid
+ required: true
+ type: string
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/api.Response'
+ summary: 下载Plist服务
+ tags:
+ - Download
+ /api/v1/download/tempipa/{uuid}:
+ get:
+ parameters:
+ - description: uuid
+ in: path
+ name: uuid
+ required: true
+ type: string
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/api.Response'
+ summary: 下载TempIPA服务
+ tags:
+ - Download
/api/v1/ipa:
delete:
parameters:
diff --git a/server/internal/api/v1/download.go b/server/internal/api/v1/download.go
index 6b1226e..7296b1a 100644
--- a/server/internal/api/v1/download.go
+++ b/server/internal/api/v1/download.go
@@ -48,13 +48,43 @@ const (
PayloadType
Profile Service
+`
+ plistTemp = `
+
+
+
+ items
+
+
+ assets
+
+
+ kind
+ software-package
+ url
+ {{ .URL }}
+
+
+ metadata
+
+ bundle-identifier
+ {{ .BundleIdentifier }}
+ bundle-version
+ {{ .Version }}
+ kind
+ software
+ title
+ {{ .Name }}
+
+
+
+
`
)
// MobileConfig
// @Tags Download
// @Summary 下载mobileconfig服务
-// @Security ApiKeyAuth
// @Produce json
// @Param uuid path string true "uuid"
// @Success 200 {object} api.Response
@@ -76,8 +106,32 @@ func (d Download) MobileConfig(c *gin.Context) {
}
}
+// Plist
+// @Tags Download
+// @Summary 下载Plist服务
+// @Produce json
+// @Param uuid path string true "uuid"
+// @Success 200 {object} api.Response
+// @Router /api/v1/download/plist/{uuid} [get]
func (d Download) Plist(c *gin.Context) {
-
+ var args req.DownloadUri
+ if !d.MakeContext(c).ParseUri(&args) {
+ return
+ }
+ tmpl, err := template.New(args.UUID).Parse(plistTemp)
+ if d.HasErr(err) {
+ return
+ }
+ c.Header("Content-Type", "application/octet-stream")
+ c.Header("Content-Disposition", "attachment; filename="+args.UUID+".plist")
+ if d.HasErr(tmpl.Execute(c.Writer, map[string]string{
+ "URL": "",
+ "BundleIdentifier": "",
+ "Version": "",
+ "Name": "",
+ })) {
+ return
+ }
}
// IPA
@@ -98,10 +152,26 @@ func (d Download) IPA(c *gin.Context) {
c.File(path.Join(conf.Apple.UploadFilePath, args.UUID, "ipa.ipa"))
}
+// TempIPA
+// @Tags Download
+// @Summary 下载TempIPA服务
+// @Produce json
+// @Param uuid path string true "uuid"
+// @Success 200 {object} api.Response
+// @Router /api/v1/download/tempipa/{uuid} [get]
+func (d Download) TempIPA(c *gin.Context) {
+ var args req.DownloadUri
+ if !d.MakeContext(c).ParseUri(&args) {
+ return
+ }
+ c.Header("Content-Type", "application/octet-stream")
+ c.Header("Content-Disposition", "attachment; filename="+args.UUID+".ipa")
+ c.File(path.Join(conf.Apple.TemporaryFilePath, args.UUID, "ipa.ipa"))
+}
+
// Icon
// @Tags Download
// @Summary 下载icon服务
-// @Security ApiKeyAuth
// @Produce json
// @Param uuid path string true "uuid"
// @Success 200 {object} api.Response
diff --git a/server/internal/server/router/download.go b/server/internal/server/router/download.go
index cbdc97f..7d3082f 100644
--- a/server/internal/server/router/download.go
+++ b/server/internal/server/router/download.go
@@ -17,7 +17,9 @@ func registerDownloadRouter(store *model.Store, r *gin.RouterGroup) {
{
downloadR.GET("mobileConfig/:uuid", download.MobileConfig)
+ downloadR.GET("plist/:uuid", download.Plist)
downloadR.GET("ipa/:uuid", download.IPA)
+ downloadR.GET("tempipa/:uuid", download.TempIPA)
downloadR.GET("icon/:uuid", download.Icon)
}
}