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 {
|
export interface Config {
|
||||||
port: number,
|
port: number
|
||||||
hosts: string[],
|
hosts: string[]
|
||||||
enableBase64?: boolean
|
enableBase64?: boolean
|
||||||
debug?: boolean
|
debug?: boolean
|
||||||
|
log?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SendMsgResult {
|
export interface SendMsgResult {
|
||||||
status: number,
|
status: number
|
||||||
retcode: number,
|
retcode: number
|
||||||
data: any,
|
data: any
|
||||||
message: string,
|
message: string
|
||||||
}
|
}
|
@ -18,7 +18,7 @@ import {
|
|||||||
} from "../common/IPCChannel";
|
} from "../common/IPCChannel";
|
||||||
import {ConfigUtil} from "./config";
|
import {ConfigUtil} from "./config";
|
||||||
import {startExpress} from "./HttpServer";
|
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 {friends, groups, selfInfo} from "./data";
|
||||||
import {} from "../global";
|
import {} from "../global";
|
||||||
|
|
||||||
@ -32,10 +32,7 @@ function onLoad() {
|
|||||||
log("main onLoaded");
|
log("main onLoaded");
|
||||||
|
|
||||||
// const config_dir = browserWindow.LiteLoader.plugins["LLOneBot"].path.data;
|
// 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)) {
|
if (!fs.existsSync(CONFIG_DIR)) {
|
||||||
fs.mkdirSync(CONFIG_DIR, {recursive: true});
|
fs.mkdirSync(CONFIG_DIR, {recursive: true});
|
||||||
|
@ -1,11 +1,21 @@
|
|||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import {json} from "express";
|
import {json} from "express";
|
||||||
import {selfInfo} from "./data";
|
import {selfInfo} from "./data";
|
||||||
|
import {ConfigUtil} from "./config";
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
export const CONFIG_DIR = global.LiteLoader.plugins["LLOneBot"].path.data;
|
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) {
|
export function log(msg: any) {
|
||||||
|
if (!getConfigUtil().getConfig().log){
|
||||||
|
return
|
||||||
|
}
|
||||||
let currentDateTime = new Date().toLocaleString();
|
let currentDateTime = new Date().toLocaleString();
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
@ -44,4 +54,4 @@ export function checkFileReceived(path: string, timeout: number=3000): Promise<v
|
|||||||
|
|
||||||
check();
|
check();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -592,7 +592,7 @@ async function onSettingWindowCreated(view: Element) {
|
|||||||
hostsEleStr += creatHostEleStr(host);
|
hostsEleStr += creatHostEleStr(host);
|
||||||
}
|
}
|
||||||
let html = `
|
let html = `
|
||||||
<div class="config_view">
|
<div class="config_view llonebot">
|
||||||
<setting-section>
|
<setting-section>
|
||||||
<setting-panel>
|
<setting-panel>
|
||||||
<setting-list class="wrap">
|
<setting-list class="wrap">
|
||||||
@ -624,6 +624,13 @@ async function onSettingWindowCreated(view: Element) {
|
|||||||
</div>
|
</div>
|
||||||
<setting-switch id="debug" ${config.debug ? "is-active" : ""}></setting-switch>
|
<setting-switch id="debug" ${config.debug ? "is-active" : ""}></setting-switch>
|
||||||
</setting-item>
|
</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-panel>
|
||||||
</setting-section>
|
</setting-section>
|
||||||
</div>
|
</div>
|
||||||
@ -634,6 +641,11 @@ async function onSettingWindowCreated(view: Element) {
|
|||||||
.tips {
|
.tips {
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
}
|
}
|
||||||
|
@media (prefers-color-scheme: dark){
|
||||||
|
.llonebot input {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
`
|
`
|
||||||
|
|
||||||
@ -667,6 +679,7 @@ async function onSettingWindowCreated(view: Element) {
|
|||||||
|
|
||||||
switchClick("debug", "debug");
|
switchClick("debug", "debug");
|
||||||
switchClick("switchBase64", "enableBase64");
|
switchClick("switchBase64", "enableBase64");
|
||||||
|
switchClick("log", "log");
|
||||||
|
|
||||||
doc.getElementById("save")?.addEventListener("click",
|
doc.getElementById("save")?.addEventListener("click",
|
||||||
() => {
|
() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user