添加一些标题文字 (#11)
This commit is contained in:
parent
d5ecb84146
commit
5216f6fc0a
|
@ -8,6 +8,7 @@ import yaml from 'yaml'
|
|||
let path = './config/config/qq.yaml'
|
||||
|
||||
// 异步函数来读取 yaml 文件
|
||||
/*
|
||||
async function getQQ () {
|
||||
function getQQPromise () {
|
||||
// eslint-disable-next-line no-async-promise-executor
|
||||
|
@ -29,9 +30,35 @@ async function getQQ () {
|
|||
console.log(err)
|
||||
})
|
||||
}
|
||||
*/
|
||||
|
||||
// 添加一些多余的标题内容
|
||||
let title = 'Miao-Yunzai'
|
||||
let qq = await fs.promises.readFile('./config/config/qq.yaml', 'UTF-8').then(yaml.parse).catch(() => null)
|
||||
if (qq) {
|
||||
title += `@${qq.qq || '首次启动'}`
|
||||
switch (qq.platform) {
|
||||
case 1:
|
||||
title += ' 安卓手机'
|
||||
break
|
||||
case 2:
|
||||
title += ' aPad'
|
||||
break
|
||||
case 3:
|
||||
title += ' 安卓手表'
|
||||
break
|
||||
case 4:
|
||||
title += ' MacOS'
|
||||
break
|
||||
case 5:
|
||||
title += ' iPad'
|
||||
}
|
||||
}
|
||||
|
||||
/** 设置标题 */
|
||||
process.title = `Miao-Yunzai ${(await getQQ()).qq === null ? '首次启动' : (await getQQ()).qq} ${(await getQQ()).platform === 1 ? '安卓手机' : (await getQQ()).platform === 2 ? 'aPad' : (await getQQ()).platform === 3 ? '安卓手表' : (await getQQ()).platform === 4 ? 'MacOS' : (await getQQ()).platform === 5 ? 'iPad' : 'Null'}`
|
||||
process.title = title
|
||||
// process.title = `Miao-Yunzai ${(await getQQ()).qq === null ? '首次启动' : (await getQQ()).qq} ${(await getQQ()).platform === 1 ? '安卓手机' : (await getQQ()).platform === 2 ? 'aPad' : (await getQQ()).platform === 3 ? '安卓手表' : (await getQQ()).platform === 4 ? 'MacOS' : (await getQQ()).platform === 5 ? 'iPad' : 'Null'}`
|
||||
|
||||
/** 设置时区 */
|
||||
process.env.TZ = 'Asia/Shanghai'
|
||||
|
||||
|
|
Loading…
Reference in New Issue