mirror of
https://github.com/crystelf/crystelf-core.git
synced 2025-07-04 14:49:19 +00:00
修复restart临时文件在Linux上的路径问题
This commit is contained in:
parent
33a0cdf946
commit
dc3101ae4b
@ -1,6 +1,8 @@
|
||||
import System from '../../utils/core/system';
|
||||
import fs from 'fs/promises';
|
||||
import logger from '../../utils/core/logger';
|
||||
import path from 'path';
|
||||
import paths from '../../utils/core/path';
|
||||
|
||||
class SystemService {
|
||||
public async systemRestart() {
|
||||
@ -10,7 +12,8 @@ class SystemService {
|
||||
|
||||
public async getRestartTime() {
|
||||
logger.debug(`有个小可爱想知道核心重启花了多久..`);
|
||||
return await fs.readFile('/temp/restart_time', 'utf8');
|
||||
const restartTimePath = path.join(paths.get('temp'), 'restart_time');
|
||||
return await fs.readFile(restartTimePath, 'utf8');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ async function testGetAPI() {
|
||||
|
||||
async function testPostAPI() {
|
||||
try {
|
||||
const response = await axios.post('https://core.crystelf.top/api/system/restart', {
|
||||
const response = await axios.post('https://core.crystelf.top/api/system/getRestartTime', {
|
||||
token: 114113,
|
||||
});
|
||||
console.log('[HTTP][POST] Response:', response.data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user