mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix: 夜间模式输入框颜色
feat: log开关
This commit is contained in:
parent
ebc3968c4e
commit
fae61fbbde
@ -181,15 +181,16 @@ export interface PostDataSendMsg {
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
port: number,
|
||||
hosts: string[],
|
||||
port: number
|
||||
hosts: string[]
|
||||
enableBase64?: boolean
|
||||
debug?: boolean
|
||||
log?: boolean
|
||||
}
|
||||
|
||||
export interface SendMsgResult {
|
||||
status: number,
|
||||
retcode: number,
|
||||
data: any,
|
||||
message: string,
|
||||
status: number
|
||||
retcode: number
|
||||
data: any
|
||||
message: string
|
||||
}
|
@ -18,7 +18,7 @@ import {
|
||||
} from "../common/IPCChannel";
|
||||
import {ConfigUtil} from "./config";
|
||||
import {startExpress} from "./HttpServer";
|
||||
import {checkFileReceived, CONFIG_DIR, isGIF, log} from "./utils";
|
||||
import {checkFileReceived, CONFIG_DIR, getConfigUtil, isGIF, log} from "./utils";
|
||||
import {friends, groups, selfInfo} from "./data";
|
||||
import {} from "../global";
|
||||
|
||||
@ -32,10 +32,7 @@ function onLoad() {
|
||||
log("main onLoaded");
|
||||
|
||||
// const config_dir = browserWindow.LiteLoader.plugins["LLOneBot"].path.data;
|
||||
function getConfigUtil() {
|
||||
const configFilePath = path.join(CONFIG_DIR, `config_${selfInfo.user_id}.json`)
|
||||
return new ConfigUtil(configFilePath)
|
||||
}
|
||||
|
||||
|
||||
if (!fs.existsSync(CONFIG_DIR)) {
|
||||
fs.mkdirSync(CONFIG_DIR, {recursive: true});
|
||||
|
@ -1,11 +1,21 @@
|
||||
import * as path from "path";
|
||||
import {json} from "express";
|
||||
import {selfInfo} from "./data";
|
||||
import {ConfigUtil} from "./config";
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
export const CONFIG_DIR = global.LiteLoader.plugins["LLOneBot"].path.data;
|
||||
|
||||
export function getConfigUtil() {
|
||||
const configFilePath = path.join(CONFIG_DIR, `config_${selfInfo.user_id}.json`)
|
||||
return new ConfigUtil(configFilePath)
|
||||
}
|
||||
|
||||
export function log(msg: any) {
|
||||
if (!getConfigUtil().getConfig().log){
|
||||
return
|
||||
}
|
||||
let currentDateTime = new Date().toLocaleString();
|
||||
const date = new Date();
|
||||
const year = date.getFullYear();
|
||||
@ -44,4 +54,4 @@ export function checkFileReceived(path: string, timeout: number=3000): Promise<v
|
||||
|
||||
check();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -592,7 +592,7 @@ async function onSettingWindowCreated(view: Element) {
|
||||
hostsEleStr += creatHostEleStr(host);
|
||||
}
|
||||
let html = `
|
||||
<div class="config_view">
|
||||
<div class="config_view llonebot">
|
||||
<setting-section>
|
||||
<setting-panel>
|
||||
<setting-list class="wrap">
|
||||
@ -624,6 +624,13 @@ async function onSettingWindowCreated(view: Element) {
|
||||
</div>
|
||||
<setting-switch id="debug" ${config.debug ? "is-active" : ""}></setting-switch>
|
||||
</setting-item>
|
||||
<setting-item data-direction="row" class="hostItem vertical-list-item">
|
||||
<div>
|
||||
<div>日志</div>
|
||||
<div class="tips">日志目录:${window.LiteLoader.plugins["LLOneBot"].path.data}</div>
|
||||
</div>
|
||||
<setting-switch id="log" ${config.log ? "is-active" : ""}></setting-switch>
|
||||
</setting-item>
|
||||
</setting-panel>
|
||||
</setting-section>
|
||||
</div>
|
||||
@ -634,6 +641,11 @@ async function onSettingWindowCreated(view: Element) {
|
||||
.tips {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
@media (prefers-color-scheme: dark){
|
||||
.llonebot input {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
`
|
||||
|
||||
@ -667,6 +679,7 @@ async function onSettingWindowCreated(view: Element) {
|
||||
|
||||
switchClick("debug", "debug");
|
||||
switchClick("switchBase64", "enableBase64");
|
||||
switchClick("log", "log");
|
||||
|
||||
doc.getElementById("save")?.addEventListener("click",
|
||||
() => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user