mirror of
https://github.com/HolographicHat/Yae.git
synced 2026-03-26 22:39:46 +08:00
support node 14 on win 7
This commit is contained in:
@@ -2,7 +2,6 @@ const cp = require("child_process")
|
||||
const axios = require("axios")
|
||||
const crypto = require("crypto")
|
||||
const { version } = require("./version")
|
||||
const { pid, argv0, uptime, report } = require("node:process")
|
||||
|
||||
const getTimestamp = (d = new Date()) => {
|
||||
const p = i => i.toString().padStart(2, "0")
|
||||
@@ -74,7 +73,7 @@ const upload = () => {
|
||||
|
||||
const uploadError = (err, fatal) => {
|
||||
const eid = crypto.randomUUID()
|
||||
const reportJson = report.getReport(err)
|
||||
const reportJson = process.report.getReport(err)
|
||||
const reportAttachment = {
|
||||
type: "errorAttachment",
|
||||
device: device,
|
||||
@@ -94,10 +93,10 @@ const uploadError = (err, fatal) => {
|
||||
architecture: "AMD64",
|
||||
userId: install,
|
||||
fatal: fatal,
|
||||
processId: pid,
|
||||
processName: argv0.replaceAll("\\", "/").split("/").pop(),
|
||||
processId: process.pid,
|
||||
processName: process.argv0.replaceAll("\\", "/").split("/").pop(),
|
||||
timestamp: getTimestamp(),
|
||||
appLaunchTimestamp: getTimestamp(new Date(Date.now() - uptime())),
|
||||
appLaunchTimestamp: getTimestamp(new Date(Date.now() - process.uptime())),
|
||||
exception: {
|
||||
"type": err.name,
|
||||
"message": err.message,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const fs = require("fs")
|
||||
const util = require("util")
|
||||
const readline = require("readline")
|
||||
const { spawnSync } = require("child_process")
|
||||
const { exec } = require("child_process")
|
||||
const { loadCache } = require("./utils")
|
||||
|
||||
const exportToSeelie = proto => {
|
||||
@@ -61,7 +60,7 @@ const exportToCocogoat = async proto => {
|
||||
date: getDate(finishTimestamp)
|
||||
})
|
||||
})
|
||||
spawnSync("clip", { input: JSON.stringify(out,null,2) })
|
||||
exec("clip").stdin.end(JSON.stringify(out,null,2))
|
||||
console.log("导出内容已复制到剪贴板")
|
||||
}
|
||||
|
||||
@@ -106,7 +105,9 @@ const exportData = async proto => {
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
})
|
||||
const question = util.promisify(rl.question).bind(rl)
|
||||
const question = (query) => new Promise(resolve => {
|
||||
rl.question(query, resolve)
|
||||
})
|
||||
const chosen = await question("导出至: \n[0] 椰羊 (https://cocogoat.work/achievement)\n[1] Paimon.moe\n[2] Seelie.me\n[3] 表格文件 (默认)\n> ")
|
||||
rl.close()
|
||||
switch (chosen) {
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"description": "",
|
||||
"main": "app.js",
|
||||
"scripts": {
|
||||
"pkg": "pkg -t node16-win-x64 -C Brotli app.js --build"
|
||||
"pkg": "pkg -t node16-win-x64 -C Brotli app.js --build",
|
||||
"pkg-for-windows7": "pkg -t node14-win-x64 -C Brotli app.js --build"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
||||
5
utils.js
5
utils.js
@@ -10,7 +10,6 @@ const { version } = require("./version")
|
||||
const { createHash } = require("crypto")
|
||||
const path = require("path")
|
||||
const messages = path.join(__dirname, "./proto/Messages.proto")
|
||||
|
||||
let axios = require("axios")
|
||||
|
||||
const sleep = ms => new Promise(resolve => {
|
||||
@@ -43,8 +42,10 @@ const initConfig = async () => {
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
})
|
||||
const question = (query) => new Promise(resolve => {
|
||||
rl.question(query, resolve)
|
||||
})
|
||||
const lookup = util.promisify(dns.lookup).bind(dns)
|
||||
const question = util.promisify(rl.question).bind(rl)
|
||||
if (fs.existsSync(configFileName)) {
|
||||
conf = JSON.parse(fs.readFileSync(configFileName, "utf-8"))
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user