feat: new application 时,basic.josn signature.json 初始化文件内容

1. 默认文件内容定义在 application.yml 中
This commit is contained in:
shizhendong
2024-10-16 17:43:25 +08:00
parent 938925e76c
commit dcc02903f7
2 changed files with 51 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
package net.geedge.asw.module.app.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.log.Log;
import net.geedge.asw.common.util.ASWException;
import net.geedge.asw.common.util.RCode;
@@ -42,6 +43,12 @@ public class GitServiceImpl implements IGitService {
@Value("${file.extensions.text:txt,csv,md,html,xml,json,log,bat,py,sh,ini,conf,yaml,yml,properties,toml,java,c,cpp,js,php,ts,go,rb,rtf,tex,rss,xhtml,sql}")
private String textExtensions;
@Value("${asw.application.template.basic.json}")
private String basicJsonTemplate;
@Value("${asw.application.template.signature.json}")
private String signatureJsonTemplate;
/**
* 本地分支引用前缀
*/
@@ -300,7 +307,19 @@ public class GitServiceImpl implements IGitService {
for (String str : T.ListUtil.of("README.md", "basic.json", "signature.json", "icon.png")) {
String savePath = T.StrUtil.concat(true, "applications/", applicationName, "/", str);
ObjectId objectId = this.insertBlobFileToDatabase(repository, T.StrUtil.EMPTY.getBytes());
String fileContent = T.StrUtil.EMPTY;
if ("basic.json".equals(str)) {
JSONObject jsonObject = T.JSONUtil.parseObj(this.basicJsonTemplate);
jsonObject.set("id", T.StrUtil.uuid());
jsonObject.set("name", applicationName);
jsonObject.set("longName", applicationName);
fileContent = T.JSONUtil.toJsonPrettyStr(jsonObject);
}
if ("signature.json".equals(str)) {
fileContent = this.signatureJsonTemplate;
}
ObjectId objectId = this.insertBlobFileToDatabase(repository, fileContent.getBytes());
filePathAndBlobIdMap.put(savePath, objectId);
}

View File

@@ -73,4 +73,34 @@ mybatis-plus:
banner: false
logging:
config: ./config/logback-spring.xml
config: ./config/logback-spring.xml
asw:
application:
template:
basic.json: |- #配置JSON格式
{
"id": "{uuid}",
"name": "{application name}",
"longName": "{application name}",
"developer": "",
"website": "",
"packageName": {
"android": "",
"ios": ""
},
"properties": {
"category": "",
"subcategory": "",
"content": "unknown",
"parentApp": "",
"risk": 1
}
}
signature.json: |-
{
"surrogates": []
}