refactor: 分离终端配置.

This commit is contained in:
lijiahangmax
2024-01-11 00:43:18 +08:00
parent b5cdd0b362
commit 7f9a97180e
21 changed files with 225 additions and 423 deletions

View File

@@ -31,7 +31,6 @@ import com.orion.ops.module.asset.enums.HostSshAuthTypeEnum;
import com.orion.ops.module.asset.handler.host.config.model.HostSshConfigModel;
import com.orion.ops.module.asset.handler.host.extra.model.HostSshExtraModel;
import com.orion.ops.module.asset.service.HostConfigService;
import com.orion.ops.module.asset.service.HostConnectLogService;
import com.orion.ops.module.asset.service.HostExtraService;
import com.orion.ops.module.asset.service.HostTerminalService;
import com.orion.ops.module.infra.api.DataPermissionApi;
@@ -57,7 +56,7 @@ import java.util.Optional;
@Service
public class HostTerminalServiceImpl implements HostTerminalService {
private static final String TERMINAL_PATH = "/template/theme/terminal.theme.json";
private static final String TERMINAL_PATH = "/theme/terminal.theme.json";
@Resource
private HostConfigService hostConfigService;
@@ -68,9 +67,6 @@ public class HostTerminalServiceImpl implements HostTerminalService {
@Resource
private AssetAuthorizedDataServiceImpl assetAuthorizedDataService;
@Resource
private HostConnectLogService hostConnectLogService;
@Resource
private HostDAO hostDAO;
@@ -89,6 +85,7 @@ public class HostTerminalServiceImpl implements HostTerminalService {
@Override
public JSONArray getTerminalThemes() {
try (InputStream in = HostTerminalService.class.getResourceAsStream(TERMINAL_PATH)) {
Valid.notNull(in, ErrorMessage.CONFIG_ABSENT);
byte[] bytes = StreamReaders.readAllBytes(in);
return JSONArray.parseArray(new String(bytes));
} catch (Exception e) {

View File

@@ -126,7 +126,7 @@
"background": "#212121",
"foreground": "#F8F8F2",
"cursor": "#ECEFF4",
"selectionBackground": "#F8F8F2",
"selectionBackground": "#44475A",
"black": "#21222C",
"red": "#FF5555",
"green": "#50FA7B",
@@ -286,5 +286,53 @@
"brightCyan": "#3AD5CE",
"brightWhite": "#EEEEEC"
}
},
{
"name": "Calamity",
"dark": true,
"schema": {
"background": "#2F2833",
"foreground": "#D5CED9",
"cursor": "#D5CED9",
"selectionBackground": "#7E6C88",
"black": "#2F2833",
"red": "#FC644D",
"green": "#A5F69C",
"yellow": "#E9D7A5",
"blue": "#3B79C7",
"cyan": "#74D3DE",
"white": "#D5CED9",
"brightBlack": "#7E6C88",
"brightRed": "#FC644D",
"brightGreen": "#A5F69C",
"brightYellow": "#E9D7A5",
"brightBlue": "#3B79C7",
"brightCyan": "#74D3DE",
"brightWhite": "#FFFFFF"
}
},
{
"name": "Tomorrow",
"dark": false,
"schema": {
"background": "#FFFFFF",
"foreground": "#4D4D4C",
"cursor": "#4D4D4C",
"selectionBackground": "#D6D6D6",
"black": "#000000",
"red": "#C82829",
"green": "#718C00",
"yellow": "#EAB700",
"blue": "#4271AE",
"cyan": "#3E999F",
"white": "#FFFFFF",
"brightBlack": "#000000",
"brightRed": "#C82829",
"brightGreen": "#718C00",
"brightYellow": "#EAB700",
"brightBlue": "#4271AE",
"brightCyan": "#3E999F",
"brightWhite": "#FFFFFF"
}
}
]
]

View File

@@ -16,13 +16,13 @@ import java.util.List;
import java.util.stream.Collectors;
/**
* 终端主题拉取 __META__
* 终端主题生成 __META__
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/7 10:52
*/
public class TerminalThemeFetcher {
public class TerminalThemeGenerator {
public static void main(String[] args) {
List<File> files = Files1.listFiles("D:\\idea-project\\iTerm2-Color-Schemes\\vhs");
@@ -33,7 +33,8 @@ public class TerminalThemeFetcher {
"Dracula", "Dracula+",
"Apple System Colors", "Builtin Tango Light",
"Duotone Dark", "BlulocoLight",
"Chester", "CLRS"
"Chester", "CLRS",
"Calamity", "Tomorrow"
);
// 颜色大写
ValueFilter colorFilter = (Object object, String name, Object value) -> {