mirror of
https://github.com/ragestudio/relic.git
synced 2025-06-09 18:44:17 +00:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
0e3889220d | |||
c996b215a3 | |||
87223efa21 | |||
6287f5fa50 | |||
98b6740839 | |||
e1d833a5f5 | |||
1e74f49e4e | |||
21152ac248 | |||
f863c27411 | |||
8b3610c518 | |||
bd719202c1 |
0
.github/workflows/release.yml
vendored
Normal file → Executable file
0
.github/workflows/release.yml
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
4
package.json
Normal file → Executable file
4
package.json
Normal file → Executable file
@ -1,9 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@ragestudio/relic-core",
|
"name": "@ragestudio/relic-core",
|
||||||
"private": true,
|
|
||||||
"workspaces": [
|
|
||||||
"packages/*"
|
|
||||||
],
|
|
||||||
"repository": "https://github.com/srgooglo/rs_bundler",
|
"repository": "https://github.com/srgooglo/rs_bundler",
|
||||||
"author": "SrGooglo <srgooglo@ragestudio.net>",
|
"author": "SrGooglo <srgooglo@ragestudio.net>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
0
packages/cli/bin
Normal file → Executable file
0
packages/cli/bin
Normal file → Executable file
0
packages/cli/package.json
Normal file → Executable file
0
packages/cli/package.json
Normal file → Executable file
0
packages/cli/src/index.js
Normal file → Executable file
0
packages/cli/src/index.js
Normal file → Executable file
0
packages/core/.swcrc
Normal file → Executable file
0
packages/core/.swcrc
Normal file → Executable file
3
packages/core/package.json
Normal file → Executable file
3
packages/core/package.json
Normal file → Executable file
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ragestudio/relic-core",
|
"name": "@ragestudio/relic-core",
|
||||||
"version": "0.19.1",
|
"version": "0.20.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "RageStudio",
|
"author": "RageStudio",
|
||||||
"description": "RageStudio Relic, yet another package manager.",
|
"description": "RageStudio Relic, yet another package manager.",
|
||||||
@ -16,6 +16,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@foxify/events": "^2.1.0",
|
"@foxify/events": "^2.1.0",
|
||||||
"adm-zip": "^0.5.12",
|
"adm-zip": "^0.5.12",
|
||||||
|
"aria2": "^4.1.2",
|
||||||
"axios": "^1.6.8",
|
"axios": "^1.6.8",
|
||||||
"checksum": "^1.0.0",
|
"checksum": "^1.0.0",
|
||||||
"cli-color": "^2.0.4",
|
"cli-color": "^2.0.4",
|
||||||
|
0
packages/core/src/classes/ManifestAuthDB.js
Normal file → Executable file
0
packages/core/src/classes/ManifestAuthDB.js
Normal file → Executable file
0
packages/core/src/classes/ManifestConfig.js
Normal file → Executable file
0
packages/core/src/classes/ManifestConfig.js
Normal file → Executable file
0
packages/core/src/classes/PatchManager.js
Normal file → Executable file
0
packages/core/src/classes/PatchManager.js
Normal file → Executable file
0
packages/core/src/classes/Settings.js
Normal file → Executable file
0
packages/core/src/classes/Settings.js
Normal file → Executable file
0
packages/core/src/db.js
Normal file → Executable file
0
packages/core/src/db.js
Normal file → Executable file
0
packages/core/src/generic_steps/git_clone.js
Normal file → Executable file
0
packages/core/src/generic_steps/git_clone.js
Normal file → Executable file
0
packages/core/src/generic_steps/git_pull.js
Normal file → Executable file
0
packages/core/src/generic_steps/git_pull.js
Normal file → Executable file
0
packages/core/src/generic_steps/git_reset.js
Normal file → Executable file
0
packages/core/src/generic_steps/git_reset.js
Normal file → Executable file
0
packages/core/src/generic_steps/http.js
Normal file → Executable file
0
packages/core/src/generic_steps/http.js
Normal file → Executable file
0
packages/core/src/generic_steps/index.js
Normal file → Executable file
0
packages/core/src/generic_steps/index.js
Normal file → Executable file
10
packages/core/src/generic_steps/torrent.js
Normal file → Executable file
10
packages/core/src/generic_steps/torrent.js
Normal file → Executable file
@ -1,10 +1,13 @@
|
|||||||
import path from "node:path"
|
import path from "node:path"
|
||||||
|
import fs from "node:fs"
|
||||||
|
|
||||||
import parseStringVars from "../utils/parseStringVars"
|
import parseStringVars from "../utils/parseStringVars"
|
||||||
//import downloadTorrent from "../helpers/downloadTorrent"
|
import downloadTorrent from "../helpers/downloadTorrent"
|
||||||
|
|
||||||
export default async (pkg, step, logger, abortController) => {
|
export default async (pkg, step, logger, abortController) => {
|
||||||
throw new Error("Not implemented")
|
if (!step.magnet) {
|
||||||
|
throw new Error(`Magnet is required for torrent step`)
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof step.path === "undefined") {
|
if (typeof step.path === "undefined") {
|
||||||
step.path = `.`
|
step.path = `.`
|
||||||
@ -38,7 +41,8 @@ export default async (pkg, step, logger, abortController) => {
|
|||||||
use_id_only: true,
|
use_id_only: true,
|
||||||
status_text: `Downloaded ${progress.transferredString} / ${progress.totalString} | ${progress.speedString}/s`,
|
status_text: `Downloaded ${progress.transferredString} / ${progress.totalString} | ${progress.speedString}/s`,
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
taskId: pkg.id
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
0
packages/core/src/handlers/apply.js
Normal file → Executable file
0
packages/core/src/handlers/apply.js
Normal file → Executable file
0
packages/core/src/handlers/authorize.js
Normal file → Executable file
0
packages/core/src/handlers/authorize.js
Normal file → Executable file
4
packages/core/src/handlers/cancelInstall.js
Normal file → Executable file
4
packages/core/src/handlers/cancelInstall.js
Normal file → Executable file
@ -15,6 +15,10 @@ export default async function reinstall(pkg_id) {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global._relic_eventBus.emit(`pkg:install:cancel`, pkg_id)
|
||||||
|
global._relic_eventBus.emit(`pkg:install:cancel:${pkg_id}`, pkg_id)
|
||||||
|
global._relic_eventBus.emit(`task:cancel:${pkg_id}`, pkg_id)
|
||||||
|
|
||||||
const task = globalThis.relic_core.tasks.find((task) => task.id === pkg_id)
|
const task = globalThis.relic_core.tasks.find((task) => task.id === pkg_id)
|
||||||
|
|
||||||
if (task) {
|
if (task) {
|
||||||
|
0
packages/core/src/handlers/checkUpdate.js
Normal file → Executable file
0
packages/core/src/handlers/checkUpdate.js
Normal file → Executable file
0
packages/core/src/handlers/deauthorize.js
Normal file → Executable file
0
packages/core/src/handlers/deauthorize.js
Normal file → Executable file
0
packages/core/src/handlers/execute.js
Normal file → Executable file
0
packages/core/src/handlers/execute.js
Normal file → Executable file
4
packages/core/src/handlers/install.js
Normal file → Executable file
4
packages/core/src/handlers/install.js
Normal file → Executable file
@ -10,7 +10,7 @@ import Apply from "../handlers/apply"
|
|||||||
|
|
||||||
const BaseLog = Logger.child({ service: "INSTALLER" })
|
const BaseLog = Logger.child({ service: "INSTALLER" })
|
||||||
|
|
||||||
export default async function install(manifest) {
|
export default async function install(manifest, options = {}) {
|
||||||
let id = null
|
let id = null
|
||||||
let abortController = new AbortController()
|
let abortController = new AbortController()
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ export default async function install(manifest) {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(manifest.installSteps)) {
|
if (Array.isArray(manifest.installSteps) && !options.noInstallSteps) {
|
||||||
Log.info(`Executing generic install steps...`)
|
Log.info(`Executing generic install steps...`)
|
||||||
|
|
||||||
global._relic_eventBus.emit(`pkg:update:state`, {
|
global._relic_eventBus.emit(`pkg:update:state`, {
|
||||||
|
0
packages/core/src/handlers/lastOperationRetry.js
Normal file → Executable file
0
packages/core/src/handlers/lastOperationRetry.js
Normal file → Executable file
0
packages/core/src/handlers/list.js
Normal file → Executable file
0
packages/core/src/handlers/list.js
Normal file → Executable file
0
packages/core/src/handlers/read.js
Normal file → Executable file
0
packages/core/src/handlers/read.js
Normal file → Executable file
0
packages/core/src/handlers/reinstall.js
Normal file → Executable file
0
packages/core/src/handlers/reinstall.js
Normal file → Executable file
0
packages/core/src/handlers/uninstall.js
Normal file → Executable file
0
packages/core/src/handlers/uninstall.js
Normal file → Executable file
0
packages/core/src/handlers/update.js
Normal file → Executable file
0
packages/core/src/handlers/update.js
Normal file → Executable file
0
packages/core/src/helpers/downloadHttpFile.js
Normal file → Executable file
0
packages/core/src/helpers/downloadHttpFile.js
Normal file → Executable file
133
packages/core/src/helpers/downloadTorrent.js
Normal file → Executable file
133
packages/core/src/helpers/downloadTorrent.js
Normal file → Executable file
@ -1,7 +1,5 @@
|
|||||||
import fs from "node:fs"
|
|
||||||
import path from "node:path"
|
|
||||||
import cliProgress from "cli-progress"
|
|
||||||
import humanFormat from "human-format"
|
import humanFormat from "human-format"
|
||||||
|
import aria2 from "aria2"
|
||||||
|
|
||||||
function convertSize(size) {
|
function convertSize(size) {
|
||||||
return `${humanFormat(size, {
|
return `${humanFormat(size, {
|
||||||
@ -17,6 +15,7 @@ export default async function downloadTorrent(
|
|||||||
onProgress,
|
onProgress,
|
||||||
onDone,
|
onDone,
|
||||||
onError,
|
onError,
|
||||||
|
taskId,
|
||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
let progressInterval = null
|
let progressInterval = null
|
||||||
@ -30,51 +29,54 @@ export default async function downloadTorrent(
|
|||||||
speedString: "0B/s",
|
speedString: "0B/s",
|
||||||
}
|
}
|
||||||
|
|
||||||
const client = new WebTorrent()
|
const client = new aria2({
|
||||||
|
host: "localhost",
|
||||||
|
port: 6800,
|
||||||
|
secure: false,
|
||||||
|
secret: "",
|
||||||
|
path: "/jsonrpc"
|
||||||
|
})
|
||||||
|
|
||||||
await new Promise((resolve, reject) => {
|
await client.open()
|
||||||
client.add(magnet, (torrentInstance) => {
|
|
||||||
const progressBar = new cliProgress.SingleBar({
|
|
||||||
format: "[{bar}] {percentage}% | {total_formatted} | {speed}/s | {eta_formatted}",
|
|
||||||
barCompleteChar: "\u2588",
|
|
||||||
barIncompleteChar: "\u2591",
|
|
||||||
hideCursor: true
|
|
||||||
}, cliProgress.Presets.shades_classic)
|
|
||||||
|
|
||||||
|
let downloadId = await client.call(
|
||||||
|
"addUri",
|
||||||
|
[magnet],
|
||||||
|
{
|
||||||
|
dir: destination,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
async function stopDownload() {
|
||||||
|
await client.call("remove", downloadId)
|
||||||
|
clearInterval(progressInterval)
|
||||||
|
}
|
||||||
|
|
||||||
|
await new Promise(async (resolve, reject) => {
|
||||||
if (typeof onStart === "function") {
|
if (typeof onStart === "function") {
|
||||||
onStart(torrentInstance)
|
onStart()
|
||||||
}
|
}
|
||||||
|
|
||||||
progressBar.start(tickProgress.total, 0, {
|
if (taskId) {
|
||||||
speed: "0B/s",
|
global._relic_eventBus.once(`task:cancel:${taskId}`, stopDownload)
|
||||||
total_formatted: tickProgress.totalString,
|
|
||||||
})
|
|
||||||
|
|
||||||
torrentInstance.on("done", () => {
|
|
||||||
progressBar.stop()
|
|
||||||
clearInterval(progressInterval)
|
|
||||||
|
|
||||||
if (typeof onDone === "function") {
|
|
||||||
onDone(torrentInstance)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(torrentInstance)
|
progressInterval = setInterval(async () => {
|
||||||
})
|
const data = await client.call("tellStatus", downloadId)
|
||||||
|
|
||||||
torrentInstance.on("error", (error) => {
|
console.log(data)
|
||||||
progressBar.stop()
|
|
||||||
clearInterval(progressInterval)
|
|
||||||
|
|
||||||
if (typeof onError === "function") {
|
if (data.status === "complete") {
|
||||||
onError(error)
|
if (Array.isArray(data.followedBy) && data.followedBy[0]) {
|
||||||
} else {
|
// replace downloadId
|
||||||
reject(error)
|
downloadId = data.followedBy[0]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
|
||||||
progressInterval = setInterval(() => {
|
tickProgress.total = parseInt(data.totalLength)
|
||||||
tickProgress.speed = torrentInstance.downloadSpeed
|
tickProgress.speed = parseInt(data.downloadSpeed)
|
||||||
tickProgress.transferred = torrentInstance.downloaded
|
tickProgress.transferred = parseInt(data.completedLength)
|
||||||
|
tickProgress.connections = data.connections
|
||||||
|
|
||||||
tickProgress.transferredString = convertSize(tickProgress.transferred)
|
tickProgress.transferredString = convertSize(tickProgress.transferred)
|
||||||
tickProgress.totalString = convertSize(tickProgress.total)
|
tickProgress.totalString = convertSize(tickProgress.total)
|
||||||
@ -83,11 +85,56 @@ export default async function downloadTorrent(
|
|||||||
if (typeof onProgress === "function") {
|
if (typeof onProgress === "function") {
|
||||||
onProgress(tickProgress)
|
onProgress(tickProgress)
|
||||||
}
|
}
|
||||||
|
|
||||||
progressBar.update(tickProgress.transferred, {
|
|
||||||
speed: tickProgress.speedString,
|
|
||||||
})
|
|
||||||
}, 1000)
|
}, 1000)
|
||||||
})
|
|
||||||
})
|
client.on("onDownloadStart", async ([{ gid }]) => {
|
||||||
|
const data = await client.call("tellStatus", gid)
|
||||||
|
|
||||||
|
console.log(data)
|
||||||
|
|
||||||
|
if (typeof data.following !== "undefined") {
|
||||||
|
if (data.following === downloadId) {
|
||||||
|
downloadId = data.gid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
client.on("onBtDownloadComplete", ([{ gid }]) => {
|
||||||
|
if (gid !== downloadId) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof onDone === "function") {
|
||||||
|
onDone()
|
||||||
|
}
|
||||||
|
|
||||||
|
stopDownload()
|
||||||
|
|
||||||
|
return resolve({
|
||||||
|
downloadId,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
client.on("onDownloadError", ([{ gid }]) => {
|
||||||
|
if (gid !== downloadId) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
stopDownload()
|
||||||
|
|
||||||
|
if (typeof onError === "function") {
|
||||||
|
onError()
|
||||||
|
}
|
||||||
|
|
||||||
|
return reject()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
await client.call("remove", downloadId)
|
||||||
|
|
||||||
|
if (taskId) {
|
||||||
|
global._relic_eventBus.off(`task:cancel:${taskId}`, stopDownload)
|
||||||
|
}
|
||||||
|
|
||||||
|
return downloadId
|
||||||
}
|
}
|
0
packages/core/src/helpers/sendToRender.js
Normal file → Executable file
0
packages/core/src/helpers/sendToRender.js
Normal file → Executable file
2
packages/core/src/helpers/setup.js
Normal file → Executable file
2
packages/core/src/helpers/setup.js
Normal file → Executable file
@ -69,7 +69,7 @@ export default async () => {
|
|||||||
await fs.promises.mkdir(path.resolve(Vars.binaries_path, prerequisite.id), { recursive: true })
|
await fs.promises.mkdir(path.resolve(Vars.binaries_path, prerequisite.id), { recursive: true })
|
||||||
|
|
||||||
if (typeof prerequisite.url === "function") {
|
if (typeof prerequisite.url === "function") {
|
||||||
prerequisite.url = await prerequisite.url(resolveOs(), os.arch())
|
prerequisite.url = await prerequisite.url(os.platform(), os.arch())
|
||||||
Log.info(`Resolved url: ${prerequisite.url}`)
|
Log.info(`Resolved url: ${prerequisite.url}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
32
packages/core/src/index.js
Normal file → Executable file
32
packages/core/src/index.js
Normal file → Executable file
@ -4,6 +4,7 @@ import { onExit } from "signal-exit"
|
|||||||
import open from "open"
|
import open from "open"
|
||||||
|
|
||||||
import SetupHelper from "./helpers/setup"
|
import SetupHelper from "./helpers/setup"
|
||||||
|
import { execa } from "./libraries/execa"
|
||||||
import Logger from "./logger"
|
import Logger from "./logger"
|
||||||
|
|
||||||
import Settings from "./classes/Settings"
|
import Settings from "./classes/Settings"
|
||||||
@ -29,7 +30,7 @@ export default class RelicCore {
|
|||||||
this.params = params
|
this.params = params
|
||||||
}
|
}
|
||||||
|
|
||||||
eventBus = global._relic_eventBus = new EventEmitter()
|
eventBus = (global._relic_eventBus = new EventEmitter())
|
||||||
|
|
||||||
logger = Logger
|
logger = Logger
|
||||||
|
|
||||||
@ -41,14 +42,34 @@ export default class RelicCore {
|
|||||||
vars: Vars,
|
vars: Vars,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(`Checking runtime_path >`, Vars.runtime_path)
|
||||||
|
|
||||||
|
if (!fs.existsSync(Vars.runtime_path)) {
|
||||||
|
fs.mkdirSync(Vars.runtime_path, { recursive: true })
|
||||||
|
}
|
||||||
|
|
||||||
await DB.initialize()
|
await DB.initialize()
|
||||||
|
|
||||||
await Settings.initialize()
|
await Settings.initialize()
|
||||||
|
|
||||||
if (!await Settings.get("packages_path")) {
|
if (!(await Settings.get("packages_path"))) {
|
||||||
await Settings.set("packages_path", Vars.packages_path)
|
await Settings.set("packages_path", Vars.packages_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.aria2c_instance = execa(
|
||||||
|
Vars.aria2_bin,
|
||||||
|
[
|
||||||
|
"--enable-rpc",
|
||||||
|
"--rpc-listen-all=true",
|
||||||
|
"--rpc-allow-origin-all",
|
||||||
|
"--file-allocation=none",
|
||||||
|
],
|
||||||
|
{
|
||||||
|
stdout: "inherit",
|
||||||
|
stderr: "inherit",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
onExit(this.onExit)
|
onExit(this.onExit)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,6 +77,10 @@ export default class RelicCore {
|
|||||||
if (fs.existsSync(Vars.cache_path)) {
|
if (fs.existsSync(Vars.cache_path)) {
|
||||||
fs.rmSync(Vars.cache_path, { recursive: true, force: true })
|
fs.rmSync(Vars.cache_path, { recursive: true, force: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.aria2c_instance) {
|
||||||
|
this.aria2c_instance.kill("SIGINT")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async setup() {
|
async setup() {
|
||||||
@ -83,7 +108,8 @@ export default class RelicCore {
|
|||||||
return open(Vars.runtime_path)
|
return open(Vars.runtime_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
const packagesPath = await Settings.get("packages_path") ?? Vars.packages_path
|
const packagesPath =
|
||||||
|
(await Settings.get("packages_path")) ?? Vars.packages_path
|
||||||
|
|
||||||
return open(packagesPath + "/" + pkg_id)
|
return open(packagesPath + "/" + pkg_id)
|
||||||
}
|
}
|
||||||
|
0
packages/core/src/libraries/execa/index.js
Normal file → Executable file
0
packages/core/src/libraries/execa/index.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/command.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/command.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/error.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/error.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/kill.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/kill.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/pipe.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/pipe.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/promise.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/promise.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/stdio.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/stdio.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/stream.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/stream.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/verbose.js
Normal file → Executable file
0
packages/core/src/libraries/execa/lib/verbose.js
Normal file → Executable file
0
packages/core/src/libraries/get-stream/array-buffer.js
Normal file → Executable file
0
packages/core/src/libraries/get-stream/array-buffer.js
Normal file → Executable file
0
packages/core/src/libraries/get-stream/array.js
Normal file → Executable file
0
packages/core/src/libraries/get-stream/array.js
Normal file → Executable file
0
packages/core/src/libraries/get-stream/buffer.js
Normal file → Executable file
0
packages/core/src/libraries/get-stream/buffer.js
Normal file → Executable file
0
packages/core/src/libraries/get-stream/contents.js
Normal file → Executable file
0
packages/core/src/libraries/get-stream/contents.js
Normal file → Executable file
0
packages/core/src/libraries/get-stream/index.js
Normal file → Executable file
0
packages/core/src/libraries/get-stream/index.js
Normal file → Executable file
0
packages/core/src/libraries/get-stream/string.js
Normal file → Executable file
0
packages/core/src/libraries/get-stream/string.js
Normal file → Executable file
0
packages/core/src/libraries/get-stream/utils.js
Normal file → Executable file
0
packages/core/src/libraries/get-stream/utils.js
Normal file → Executable file
0
packages/core/src/libraries/human-signals/core.js
Normal file → Executable file
0
packages/core/src/libraries/human-signals/core.js
Normal file → Executable file
0
packages/core/src/libraries/human-signals/index.js
Normal file → Executable file
0
packages/core/src/libraries/human-signals/index.js
Normal file → Executable file
0
packages/core/src/libraries/human-signals/realtime.js
Normal file → Executable file
0
packages/core/src/libraries/human-signals/realtime.js
Normal file → Executable file
0
packages/core/src/libraries/human-signals/signals.js
Normal file → Executable file
0
packages/core/src/libraries/human-signals/signals.js
Normal file → Executable file
0
packages/core/src/libraries/is-stream/index.js
Normal file → Executable file
0
packages/core/src/libraries/is-stream/index.js
Normal file → Executable file
0
packages/core/src/libraries/lowdb/adapters/Memory.js
Normal file → Executable file
0
packages/core/src/libraries/lowdb/adapters/Memory.js
Normal file → Executable file
0
packages/core/src/libraries/lowdb/adapters/node/DataFile.js
Normal file → Executable file
0
packages/core/src/libraries/lowdb/adapters/node/DataFile.js
Normal file → Executable file
0
packages/core/src/libraries/lowdb/adapters/node/JSONFile.js
Normal file → Executable file
0
packages/core/src/libraries/lowdb/adapters/node/JSONFile.js
Normal file → Executable file
0
packages/core/src/libraries/lowdb/adapters/node/TextFile.js
Normal file → Executable file
0
packages/core/src/libraries/lowdb/adapters/node/TextFile.js
Normal file → Executable file
0
packages/core/src/libraries/lowdb/core/Low.js
Normal file → Executable file
0
packages/core/src/libraries/lowdb/core/Low.js
Normal file → Executable file
0
packages/core/src/libraries/lowdb/presets/node.js
Normal file → Executable file
0
packages/core/src/libraries/lowdb/presets/node.js
Normal file → Executable file
0
packages/core/src/libraries/lowdb/steno/index.js
Normal file → Executable file
0
packages/core/src/libraries/lowdb/steno/index.js
Normal file → Executable file
0
packages/core/src/libraries/mimic-function/index.js
Normal file → Executable file
0
packages/core/src/libraries/mimic-function/index.js
Normal file → Executable file
0
packages/core/src/libraries/npm-run-path/index.js
Normal file → Executable file
0
packages/core/src/libraries/npm-run-path/index.js
Normal file → Executable file
0
packages/core/src/libraries/onetime/index.js
Normal file → Executable file
0
packages/core/src/libraries/onetime/index.js
Normal file → Executable file
0
packages/core/src/libraries/strip-final-newline/index.js
Normal file → Executable file
0
packages/core/src/libraries/strip-final-newline/index.js
Normal file → Executable file
0
packages/core/src/logger.js
Normal file → Executable file
0
packages/core/src/logger.js
Normal file → Executable file
0
packages/core/src/manifest/libraries.js
Normal file → Executable file
0
packages/core/src/manifest/libraries.js
Normal file → Executable file
0
packages/core/src/manifest/libs/auth/index.js
Normal file → Executable file
0
packages/core/src/manifest/libs/auth/index.js
Normal file → Executable file
34
packages/core/src/manifest/libs/extract/index.js
Executable file
34
packages/core/src/manifest/libs/extract/index.js
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
import extractFile from "../../../utils/extractFile"
|
||||||
|
import { execa } from "../../../libraries/execa"
|
||||||
|
import Vars from "../../../vars"
|
||||||
|
|
||||||
|
export default class Extract {
|
||||||
|
async extractFull(file, dest, { password } = {}) {
|
||||||
|
const args = [
|
||||||
|
"x",
|
||||||
|
"-y",
|
||||||
|
]
|
||||||
|
|
||||||
|
if (password) {
|
||||||
|
args.push(`-p"${password}"`)
|
||||||
|
}
|
||||||
|
|
||||||
|
args.push(`-o"${dest}"`)
|
||||||
|
|
||||||
|
args.push(`"${file}"`)
|
||||||
|
|
||||||
|
const cmd = `${Vars.sevenzip_bin} ${args.join(" ")}`
|
||||||
|
|
||||||
|
console.log(cmd)
|
||||||
|
|
||||||
|
await execa(cmd, {
|
||||||
|
shell: true,
|
||||||
|
stdout: "inherit",
|
||||||
|
stderr: "inherit",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async autoExtract(file, dest) {
|
||||||
|
return await extractFile(file, dest)
|
||||||
|
}
|
||||||
|
}
|
32
packages/core/src/manifest/libs/fs/index.js
Normal file → Executable file
32
packages/core/src/manifest/libs/fs/index.js
Normal file → Executable file
@ -36,4 +36,36 @@ export default class SecureFileSystem {
|
|||||||
existsSync(...args) {
|
existsSync(...args) {
|
||||||
return fs.existsSync(...args)
|
return fs.existsSync(...args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async rename(from, to) {
|
||||||
|
this.checkOutsideJail(from)
|
||||||
|
this.checkOutsideJail(to)
|
||||||
|
|
||||||
|
return await fs.promises.rename(from, to)
|
||||||
|
}
|
||||||
|
|
||||||
|
async writeFile(path, data, options) {
|
||||||
|
this.checkOutsideJail(path)
|
||||||
|
return await fs.promises.writeFile(path, data, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
async readDir(path) {
|
||||||
|
this.checkOutsideJail(path)
|
||||||
|
return await fs.promises.readdir(path)
|
||||||
|
}
|
||||||
|
|
||||||
|
async rm(path, options) {
|
||||||
|
this.checkOutsideJail(path)
|
||||||
|
return await fs.promises.rm(path, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
async mkdir(path, options) {
|
||||||
|
this.checkOutsideJail(path)
|
||||||
|
return await fs.promises.mkdir(path, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
async stat(path) {
|
||||||
|
this.checkOutsideJail(path)
|
||||||
|
return await fs.promises.stat(path)
|
||||||
|
}
|
||||||
}
|
}
|
4
packages/core/src/manifest/libs/index.js
Normal file → Executable file
4
packages/core/src/manifest/libs/index.js
Normal file → Executable file
@ -2,6 +2,7 @@ import Open from "./open"
|
|||||||
import Path from "./path"
|
import Path from "./path"
|
||||||
import Fs from "./fs"
|
import Fs from "./fs"
|
||||||
import Auth from "./auth"
|
import Auth from "./auth"
|
||||||
|
import Extract from "./extract"
|
||||||
|
|
||||||
// Third party libraries
|
// Third party libraries
|
||||||
import Mcl from "./mcl"
|
import Mcl from "./mcl"
|
||||||
@ -11,5 +12,6 @@ export default {
|
|||||||
path: Path,
|
path: Path,
|
||||||
open: Open,
|
open: Open,
|
||||||
auth: Auth,
|
auth: Auth,
|
||||||
mcl: Mcl
|
extract: Extract,
|
||||||
|
mcl: Mcl,
|
||||||
}
|
}
|
0
packages/core/src/manifest/libs/mcl/authenticator.js
Normal file → Executable file
0
packages/core/src/manifest/libs/mcl/authenticator.js
Normal file → Executable file
0
packages/core/src/manifest/libs/mcl/handler.js
Normal file → Executable file
0
packages/core/src/manifest/libs/mcl/handler.js
Normal file → Executable file
0
packages/core/src/manifest/libs/mcl/index.js
Normal file → Executable file
0
packages/core/src/manifest/libs/mcl/index.js
Normal file → Executable file
0
packages/core/src/manifest/libs/mcl/launcher.js
Normal file → Executable file
0
packages/core/src/manifest/libs/mcl/launcher.js
Normal file → Executable file
0
packages/core/src/manifest/libs/open/index.js
Normal file → Executable file
0
packages/core/src/manifest/libs/open/index.js
Normal file → Executable file
0
packages/core/src/manifest/libs/path/index.js
Normal file → Executable file
0
packages/core/src/manifest/libs/path/index.js
Normal file → Executable file
0
packages/core/src/manifest/reader.js
Normal file → Executable file
0
packages/core/src/manifest/reader.js
Normal file → Executable file
0
packages/core/src/manifest/vm.js
Normal file → Executable file
0
packages/core/src/manifest/vm.js
Normal file → Executable file
25
packages/core/src/prerequisites.js
Normal file → Executable file
25
packages/core/src/prerequisites.js
Normal file → Executable file
@ -9,9 +9,11 @@ export default [
|
|||||||
{
|
{
|
||||||
id: "7z-bin",
|
id: "7z-bin",
|
||||||
finalBin: Vars.sevenzip_bin,
|
finalBin: Vars.sevenzip_bin,
|
||||||
url: resolveRemoteBinPath(`${baseURL}/7zip-bin`, process.platform === "win32" ? "7za.exe" : "7za"),
|
url: resolveRemoteBinPath(`${baseURL}/7z-full`, "7z.zip"),
|
||||||
destination: Vars.sevenzip_bin,
|
destination: path.resolve(Vars.binaries_path, "7z.zip"),
|
||||||
|
extract: path.resolve(Vars.binaries_path, "7z-bin"),
|
||||||
rewriteExecutionPermission: true,
|
rewriteExecutionPermission: true,
|
||||||
|
deleteBeforeExtract: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "git-bin",
|
id: "git-bin",
|
||||||
@ -24,14 +26,13 @@ export default [
|
|||||||
deleteBeforeExtract: true,
|
deleteBeforeExtract: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "rclone-bin",
|
id: "aria2",
|
||||||
finalBin: Vars.rclone_bin,
|
finalBin: Vars.aria2_bin,
|
||||||
url: resolveRemoteBinPath(`${baseURL}/rclone`, "rclone-bin.zip"),
|
url: async (os, arch) => {
|
||||||
destination: path.resolve(Vars.binaries_path, "rclone-bin.zip"),
|
return `https://storage.ragestudio.net/rstudio/binaries/aria2/${os}/${arch}/${os === "win32" ? "aria2c.exe" : "aria2c"}`
|
||||||
extract: path.resolve(Vars.binaries_path, "rclone-bin"),
|
},
|
||||||
requireOs: ["win32"],
|
destination: Vars.aria2_bin,
|
||||||
rewriteExecutionPermission: true,
|
rewriteExecutionPermission: Vars.aria2_bin,
|
||||||
deleteBeforeExtract: true,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "java22_jre_bin",
|
id: "java22_jre_bin",
|
||||||
@ -43,7 +44,7 @@ export default [
|
|||||||
params: {
|
params: {
|
||||||
arch: arch,
|
arch: arch,
|
||||||
java_version: "22",
|
java_version: "22",
|
||||||
os: os,
|
os: os === "win32" ? "windows" : os,
|
||||||
archive_type: "zip",
|
archive_type: "zip",
|
||||||
javafx_bundled: "false",
|
javafx_bundled: "false",
|
||||||
java_package_type: "jre",
|
java_package_type: "jre",
|
||||||
@ -77,7 +78,7 @@ export default [
|
|||||||
params: {
|
params: {
|
||||||
arch: arch,
|
arch: arch,
|
||||||
java_version: "17",
|
java_version: "17",
|
||||||
os: os,
|
os: os === "win32" ? "windows" : os,
|
||||||
archive_type: "zip",
|
archive_type: "zip",
|
||||||
javafx_bundled: "false",
|
javafx_bundled: "false",
|
||||||
java_package_type: "jre",
|
java_package_type: "jre",
|
||||||
|
0
packages/core/src/utils/chmodRecursive.js
Normal file → Executable file
0
packages/core/src/utils/chmodRecursive.js
Normal file → Executable file
0
packages/core/src/utils/extractFile.js
Normal file → Executable file
0
packages/core/src/utils/extractFile.js
Normal file → Executable file
0
packages/core/src/utils/parseStringVars.js
Normal file → Executable file
0
packages/core/src/utils/parseStringVars.js
Normal file → Executable file
0
packages/core/src/utils/readDirRecurse.js
Normal file → Executable file
0
packages/core/src/utils/readDirRecurse.js
Normal file → Executable file
0
packages/core/src/utils/resolveOs.js
Normal file → Executable file
0
packages/core/src/utils/resolveOs.js
Normal file → Executable file
4
packages/core/src/utils/resolveRemoteBinPath.js
Normal file → Executable file
4
packages/core/src/utils/resolveRemoteBinPath.js
Normal file → Executable file
@ -2,10 +2,10 @@ export default (pre, post) => {
|
|||||||
let url = null
|
let url = null
|
||||||
|
|
||||||
if (process.platform === "darwin") {
|
if (process.platform === "darwin") {
|
||||||
url = `${pre}/mac/${process.arch}/${post}`
|
url = `${pre}/darwin/${process.arch}/${post}`
|
||||||
}
|
}
|
||||||
else if (process.platform === "win32") {
|
else if (process.platform === "win32") {
|
||||||
url = `${pre}/win/${process.arch}/${post}`
|
url = `${pre}/win32/${process.arch}/${post}`
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
url = `${pre}/linux/${process.arch}/${post}`
|
url = `${pre}/linux/${process.arch}/${post}`
|
||||||
|
0
packages/core/src/utils/resolveUserDataPath.js
Normal file → Executable file
0
packages/core/src/utils/resolveUserDataPath.js
Normal file → Executable file
47
packages/core/src/vars.js
Normal file → Executable file
47
packages/core/src/vars.js
Normal file → Executable file
@ -2,7 +2,7 @@ import path from "node:path"
|
|||||||
import upath from "upath"
|
import upath from "upath"
|
||||||
import resolveUserDataPath from "./utils/resolveUserDataPath"
|
import resolveUserDataPath from "./utils/resolveUserDataPath"
|
||||||
|
|
||||||
const isWin = process.platform.includes("win")
|
const isWin = process.platform.includes("win32")
|
||||||
const isMac = process.platform.includes("darwin")
|
const isMac = process.platform.includes("darwin")
|
||||||
|
|
||||||
const runtimeName = "rs-relic"
|
const runtimeName = "rs-relic"
|
||||||
@ -11,15 +11,48 @@ const userdata_path = resolveUserDataPath()
|
|||||||
const runtime_path = upath.normalizeSafe(path.join(userdata_path, runtimeName))
|
const runtime_path = upath.normalizeSafe(path.join(userdata_path, runtimeName))
|
||||||
const cache_path = upath.normalizeSafe(path.join(runtime_path, "cache"))
|
const cache_path = upath.normalizeSafe(path.join(runtime_path, "cache"))
|
||||||
const packages_path = upath.normalizeSafe(path.join(runtime_path, "packages"))
|
const packages_path = upath.normalizeSafe(path.join(runtime_path, "packages"))
|
||||||
const binaries_path = upath.normalizeSafe(path.resolve(runtime_path, "binaries"))
|
const binaries_path = upath.normalizeSafe(
|
||||||
|
path.resolve(runtime_path, "binaries"),
|
||||||
|
)
|
||||||
const db_path = upath.normalizeSafe(path.resolve(runtime_path, "db.json"))
|
const db_path = upath.normalizeSafe(path.resolve(runtime_path, "db.json"))
|
||||||
|
|
||||||
const binaries = {
|
const binaries = {
|
||||||
sevenzip_bin: upath.normalizeSafe(path.resolve(binaries_path, "7z-bin", isWin ? "7za.exe" : "7za")),
|
sevenzip_bin: upath.normalizeSafe(
|
||||||
git_bin: upath.normalizeSafe(path.resolve(binaries_path, "git-bin", "bin", isWin ? "git.exe" : "git")),
|
path.resolve(binaries_path, "7z-bin", isWin ? "7za.exe" : "7z"),
|
||||||
rclone_bin: upath.normalizeSafe(path.resolve(binaries_path, "rclone-bin", isWin ? "rclone.exe" : "rclone")),
|
),
|
||||||
java22_jre_bin: upath.normalizeSafe(path.resolve(binaries_path, "java22_jre_bin", (isMac ? "Contents/Home/bin/java" : (isWin ? "bin/java.exe" : "bin/java")))),
|
git_bin: upath.normalizeSafe(
|
||||||
java17_jre_bin: upath.normalizeSafe(path.resolve(binaries_path, "java17_jre_bin", (isMac ? "Contents/Home/bin/java" : (isWin ? "bin/java.exe" : "bin/java")))),
|
path.resolve(
|
||||||
|
binaries_path,
|
||||||
|
"git-bin",
|
||||||
|
"bin",
|
||||||
|
isWin ? "git.exe" : "git",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
aria2_bin: upath.normalizeSafe(
|
||||||
|
path.resolve(binaries_path, "aria2", isWin ? "aria2c.exe" : "aria2c"),
|
||||||
|
),
|
||||||
|
java22_jre_bin: upath.normalizeSafe(
|
||||||
|
path.resolve(
|
||||||
|
binaries_path,
|
||||||
|
"java22_jre_bin",
|
||||||
|
isMac
|
||||||
|
? "Contents/Home/bin/java"
|
||||||
|
: isWin
|
||||||
|
? "bin/java.exe"
|
||||||
|
: "bin/java",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
java17_jre_bin: upath.normalizeSafe(
|
||||||
|
path.resolve(
|
||||||
|
binaries_path,
|
||||||
|
"java17_jre_bin",
|
||||||
|
isMac
|
||||||
|
? "Contents/Home/bin/java"
|
||||||
|
: isWin
|
||||||
|
? "bin/java.exe"
|
||||||
|
: "bin/java",
|
||||||
|
),
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
4
packages/gui/electron-builder.yml
Normal file → Executable file
4
packages/gui/electron-builder.yml
Normal file → Executable file
@ -26,10 +26,10 @@ dmg:
|
|||||||
linux:
|
linux:
|
||||||
target:
|
target:
|
||||||
- AppImage
|
- AppImage
|
||||||
- snap
|
|
||||||
- deb
|
- deb
|
||||||
maintainer: electronjs.org
|
maintainer: ragestudio.net
|
||||||
category: Utility
|
category: Utility
|
||||||
|
icon: resources/icon.png
|
||||||
appImage:
|
appImage:
|
||||||
artifactName: ${productName}-${version}.${ext}
|
artifactName: ${productName}-${version}.${ext}
|
||||||
npmRebuild: false
|
npmRebuild: false
|
||||||
|
0
packages/gui/electron.vite.config.js
Normal file → Executable file
0
packages/gui/electron.vite.config.js
Normal file → Executable file
7
packages/gui/package.json
Normal file → Executable file
7
packages/gui/package.json
Normal file → Executable file
@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@ragestudio/relic-gui",
|
"name": "relic-gui",
|
||||||
"version": "0.19.1",
|
"version": "0.20.3",
|
||||||
"description": "RageStudio Relic, yet another package manager.",
|
"description": "RageStudio Relic, yet another package manager.",
|
||||||
|
"homepage": "https://relic.ragestudio.net",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "RageStudio",
|
"author": "RageStudio",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -24,7 +25,7 @@
|
|||||||
"@getstation/electron-google-oauth2": "^14.0.0",
|
"@getstation/electron-google-oauth2": "^14.0.0",
|
||||||
"@imjs/electron-differential-updater": "^5.1.7",
|
"@imjs/electron-differential-updater": "^5.1.7",
|
||||||
"@loadable/component": "^5.16.3",
|
"@loadable/component": "^5.16.3",
|
||||||
"@ragestudio/relic-core": "^0.19.1",
|
"@ragestudio/relic-core": "^0.20.3",
|
||||||
"antd": "^5.13.2",
|
"antd": "^5.13.2",
|
||||||
"classnames": "^2.3.2",
|
"classnames": "^2.3.2",
|
||||||
"electron-differential-updater": "^4.3.2",
|
"electron-differential-updater": "^4.3.2",
|
||||||
|
0
packages/gui/resources/icon.ico
Normal file → Executable file
0
packages/gui/resources/icon.ico
Normal file → Executable file
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 14 KiB |
0
packages/gui/resources/icon.svg
Normal file → Executable file
0
packages/gui/resources/icon.svg
Normal file → Executable file
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
0
packages/gui/src/main/classes/CoreAdapter.js
Normal file → Executable file
0
packages/gui/src/main/classes/CoreAdapter.js
Normal file → Executable file
0
packages/gui/src/main/index.js
Normal file → Executable file
0
packages/gui/src/main/index.js
Normal file → Executable file
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user