mirror of
https://github.com/ragestudio/relic.git
synced 2025-06-09 18:44:17 +00:00
Compare commits
No commits in common. "main" and "v0.19.1" have entirely different histories.
0
.github/workflows/release.yml
vendored
Executable file → Normal file
0
.github/workflows/release.yml
vendored
Executable file → Normal file
0
.gitignore
vendored
Executable file → Normal file
0
.gitignore
vendored
Executable file → Normal file
4
package.json
Executable file → Normal file
4
package.json
Executable file → Normal file
@ -1,5 +1,9 @@
|
||||
{
|
||||
"name": "@ragestudio/relic-core",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"repository": "https://github.com/srgooglo/rs_bundler",
|
||||
"author": "SrGooglo <srgooglo@ragestudio.net>",
|
||||
"license": "MIT",
|
||||
|
0
packages/cli/bin
Executable file → Normal file
0
packages/cli/bin
Executable file → Normal file
0
packages/cli/package.json
Executable file → Normal file
0
packages/cli/package.json
Executable file → Normal file
0
packages/cli/src/index.js
Executable file → Normal file
0
packages/cli/src/index.js
Executable file → Normal file
0
packages/core/.swcrc
Executable file → Normal file
0
packages/core/.swcrc
Executable file → Normal file
85
packages/core/package.json
Executable file → Normal file
85
packages/core/package.json
Executable file → Normal file
@ -1,45 +1,44 @@
|
||||
{
|
||||
"name": "@ragestudio/relic-core",
|
||||
"version": "0.20.3",
|
||||
"license": "MIT",
|
||||
"author": "RageStudio",
|
||||
"description": "RageStudio Relic, yet another package manager.",
|
||||
"main": "./dist/index.js",
|
||||
"files": [
|
||||
"dist",
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "hermes build",
|
||||
"build:swc": "npx swc ./src --out-dir ./dist --strip-leading-paths"
|
||||
},
|
||||
"dependencies": {
|
||||
"@foxify/events": "^2.1.0",
|
||||
"adm-zip": "^0.5.12",
|
||||
"aria2": "^4.1.2",
|
||||
"axios": "^1.6.8",
|
||||
"checksum": "^1.0.0",
|
||||
"cli-color": "^2.0.4",
|
||||
"cli-progress": "^3.12.0",
|
||||
"deep-object-diff": "^1.1.9",
|
||||
"extends-classes": "^1.0.5",
|
||||
"googleapis": "^134.0.0",
|
||||
"human-format": "^1.2.0",
|
||||
"merge-stream": "^2.0.0",
|
||||
"module-alias": "^2.2.3",
|
||||
"node-7z": "^3.0.0",
|
||||
"open": "8.4.2",
|
||||
"request": "^2.88.2",
|
||||
"rimraf": "^5.0.5",
|
||||
"signal-exit": "^4.1.0",
|
||||
"unzipper": "^0.10.14",
|
||||
"upath": "^2.0.1",
|
||||
"uuid": "^9.0.1",
|
||||
"webtorrent": "^2.4.1",
|
||||
"winston": "^3.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.3.12",
|
||||
"@swc/core": "^1.4.11"
|
||||
}
|
||||
"name": "@ragestudio/relic-core",
|
||||
"version": "0.19.1",
|
||||
"license": "MIT",
|
||||
"author": "RageStudio",
|
||||
"description": "RageStudio Relic, yet another package manager.",
|
||||
"main": "./dist/index.js",
|
||||
"files": [
|
||||
"dist",
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "hermes build",
|
||||
"build:swc": "npx swc ./src --out-dir ./dist --strip-leading-paths"
|
||||
},
|
||||
"dependencies": {
|
||||
"@foxify/events": "^2.1.0",
|
||||
"adm-zip": "^0.5.12",
|
||||
"axios": "^1.6.8",
|
||||
"checksum": "^1.0.0",
|
||||
"cli-color": "^2.0.4",
|
||||
"cli-progress": "^3.12.0",
|
||||
"deep-object-diff": "^1.1.9",
|
||||
"extends-classes": "^1.0.5",
|
||||
"googleapis": "^134.0.0",
|
||||
"human-format": "^1.2.0",
|
||||
"merge-stream": "^2.0.0",
|
||||
"module-alias": "^2.2.3",
|
||||
"node-7z": "^3.0.0",
|
||||
"open": "8.4.2",
|
||||
"request": "^2.88.2",
|
||||
"rimraf": "^5.0.5",
|
||||
"signal-exit": "^4.1.0",
|
||||
"unzipper": "^0.10.14",
|
||||
"upath": "^2.0.1",
|
||||
"uuid": "^9.0.1",
|
||||
"webtorrent": "^2.4.1",
|
||||
"winston": "^3.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.3.12",
|
||||
"@swc/core": "^1.4.11"
|
||||
}
|
||||
}
|
0
packages/core/src/classes/ManifestAuthDB.js
Executable file → Normal file
0
packages/core/src/classes/ManifestAuthDB.js
Executable file → Normal file
0
packages/core/src/classes/ManifestConfig.js
Executable file → Normal file
0
packages/core/src/classes/ManifestConfig.js
Executable file → Normal file
0
packages/core/src/classes/PatchManager.js
Executable file → Normal file
0
packages/core/src/classes/PatchManager.js
Executable file → Normal file
0
packages/core/src/classes/Settings.js
Executable file → Normal file
0
packages/core/src/classes/Settings.js
Executable file → Normal file
0
packages/core/src/db.js
Executable file → Normal file
0
packages/core/src/db.js
Executable file → Normal file
0
packages/core/src/generic_steps/git_clone.js
Executable file → Normal file
0
packages/core/src/generic_steps/git_clone.js
Executable file → Normal file
0
packages/core/src/generic_steps/git_pull.js
Executable file → Normal file
0
packages/core/src/generic_steps/git_pull.js
Executable file → Normal file
0
packages/core/src/generic_steps/git_reset.js
Executable file → Normal file
0
packages/core/src/generic_steps/git_reset.js
Executable file → Normal file
0
packages/core/src/generic_steps/http.js
Executable file → Normal file
0
packages/core/src/generic_steps/http.js
Executable file → Normal file
0
packages/core/src/generic_steps/index.js
Executable file → Normal file
0
packages/core/src/generic_steps/index.js
Executable file → Normal file
10
packages/core/src/generic_steps/torrent.js
Executable file → Normal file
10
packages/core/src/generic_steps/torrent.js
Executable file → Normal file
@ -1,13 +1,10 @@
|
||||
import path from "node:path"
|
||||
import fs from "node:fs"
|
||||
|
||||
import parseStringVars from "../utils/parseStringVars"
|
||||
import downloadTorrent from "../helpers/downloadTorrent"
|
||||
//import downloadTorrent from "../helpers/downloadTorrent"
|
||||
|
||||
export default async (pkg, step, logger, abortController) => {
|
||||
if (!step.magnet) {
|
||||
throw new Error(`Magnet is required for torrent step`)
|
||||
}
|
||||
throw new Error("Not implemented")
|
||||
|
||||
if (typeof step.path === "undefined") {
|
||||
step.path = `.`
|
||||
@ -41,8 +38,7 @@ export default async (pkg, step, logger, abortController) => {
|
||||
use_id_only: true,
|
||||
status_text: `Downloaded ${progress.transferredString} / ${progress.totalString} | ${progress.speedString}/s`,
|
||||
})
|
||||
},
|
||||
taskId: pkg.id
|
||||
}
|
||||
})
|
||||
|
||||
}
|
0
packages/core/src/handlers/apply.js
Executable file → Normal file
0
packages/core/src/handlers/apply.js
Executable file → Normal file
0
packages/core/src/handlers/authorize.js
Executable file → Normal file
0
packages/core/src/handlers/authorize.js
Executable file → Normal file
4
packages/core/src/handlers/cancelInstall.js
Executable file → Normal file
4
packages/core/src/handlers/cancelInstall.js
Executable file → Normal file
@ -15,10 +15,6 @@ export default async function reinstall(pkg_id) {
|
||||
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)
|
||||
|
||||
if (task) {
|
||||
|
0
packages/core/src/handlers/checkUpdate.js
Executable file → Normal file
0
packages/core/src/handlers/checkUpdate.js
Executable file → Normal file
0
packages/core/src/handlers/deauthorize.js
Executable file → Normal file
0
packages/core/src/handlers/deauthorize.js
Executable file → Normal file
0
packages/core/src/handlers/execute.js
Executable file → Normal file
0
packages/core/src/handlers/execute.js
Executable file → Normal file
4
packages/core/src/handlers/install.js
Executable file → Normal file
4
packages/core/src/handlers/install.js
Executable file → Normal file
@ -10,7 +10,7 @@ import Apply from "../handlers/apply"
|
||||
|
||||
const BaseLog = Logger.child({ service: "INSTALLER" })
|
||||
|
||||
export default async function install(manifest, options = {}) {
|
||||
export default async function install(manifest) {
|
||||
let id = null
|
||||
let abortController = new AbortController()
|
||||
|
||||
@ -112,7 +112,7 @@ export default async function install(manifest, options = {}) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (Array.isArray(manifest.installSteps) && !options.noInstallSteps) {
|
||||
if (Array.isArray(manifest.installSteps)) {
|
||||
Log.info(`Executing generic install steps...`)
|
||||
|
||||
global._relic_eventBus.emit(`pkg:update:state`, {
|
||||
|
0
packages/core/src/handlers/lastOperationRetry.js
Executable file → Normal file
0
packages/core/src/handlers/lastOperationRetry.js
Executable file → Normal file
0
packages/core/src/handlers/list.js
Executable file → Normal file
0
packages/core/src/handlers/list.js
Executable file → Normal file
0
packages/core/src/handlers/read.js
Executable file → Normal file
0
packages/core/src/handlers/read.js
Executable file → Normal file
0
packages/core/src/handlers/reinstall.js
Executable file → Normal file
0
packages/core/src/handlers/reinstall.js
Executable file → Normal file
0
packages/core/src/handlers/uninstall.js
Executable file → Normal file
0
packages/core/src/handlers/uninstall.js
Executable file → Normal file
0
packages/core/src/handlers/update.js
Executable file → Normal file
0
packages/core/src/handlers/update.js
Executable file → Normal file
0
packages/core/src/helpers/downloadHttpFile.js
Executable file → Normal file
0
packages/core/src/helpers/downloadHttpFile.js
Executable file → Normal file
151
packages/core/src/helpers/downloadTorrent.js
Executable file → Normal file
151
packages/core/src/helpers/downloadTorrent.js
Executable file → Normal file
@ -1,5 +1,7 @@
|
||||
import fs from "node:fs"
|
||||
import path from "node:path"
|
||||
import cliProgress from "cli-progress"
|
||||
import humanFormat from "human-format"
|
||||
import aria2 from "aria2"
|
||||
|
||||
function convertSize(size) {
|
||||
return `${humanFormat(size, {
|
||||
@ -15,7 +17,6 @@ export default async function downloadTorrent(
|
||||
onProgress,
|
||||
onDone,
|
||||
onError,
|
||||
taskId,
|
||||
} = {}
|
||||
) {
|
||||
let progressInterval = null
|
||||
@ -29,112 +30,64 @@ export default async function downloadTorrent(
|
||||
speedString: "0B/s",
|
||||
}
|
||||
|
||||
const client = new aria2({
|
||||
host: "localhost",
|
||||
port: 6800,
|
||||
secure: false,
|
||||
secret: "",
|
||||
path: "/jsonrpc"
|
||||
})
|
||||
const client = new WebTorrent()
|
||||
|
||||
await client.open()
|
||||
await new Promise((resolve, reject) => {
|
||||
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") {
|
||||
onStart()
|
||||
}
|
||||
|
||||
if (taskId) {
|
||||
global._relic_eventBus.once(`task:cancel:${taskId}`, stopDownload)
|
||||
}
|
||||
|
||||
progressInterval = setInterval(async () => {
|
||||
const data = await client.call("tellStatus", downloadId)
|
||||
|
||||
console.log(data)
|
||||
|
||||
if (data.status === "complete") {
|
||||
if (Array.isArray(data.followedBy) && data.followedBy[0]) {
|
||||
// replace downloadId
|
||||
downloadId = data.followedBy[0]
|
||||
}
|
||||
if (typeof onStart === "function") {
|
||||
onStart(torrentInstance)
|
||||
}
|
||||
|
||||
tickProgress.total = parseInt(data.totalLength)
|
||||
tickProgress.speed = parseInt(data.downloadSpeed)
|
||||
tickProgress.transferred = parseInt(data.completedLength)
|
||||
tickProgress.connections = data.connections
|
||||
|
||||
tickProgress.transferredString = convertSize(tickProgress.transferred)
|
||||
tickProgress.totalString = convertSize(tickProgress.total)
|
||||
tickProgress.speedString = convertSize(tickProgress.speed)
|
||||
|
||||
if (typeof onProgress === "function") {
|
||||
onProgress(tickProgress)
|
||||
}
|
||||
}, 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,
|
||||
progressBar.start(tickProgress.total, 0, {
|
||||
speed: "0B/s",
|
||||
total_formatted: tickProgress.totalString,
|
||||
})
|
||||
})
|
||||
|
||||
client.on("onDownloadError", ([{ gid }]) => {
|
||||
if (gid !== downloadId) {
|
||||
return false
|
||||
}
|
||||
torrentInstance.on("done", () => {
|
||||
progressBar.stop()
|
||||
clearInterval(progressInterval)
|
||||
|
||||
stopDownload()
|
||||
if (typeof onDone === "function") {
|
||||
onDone(torrentInstance)
|
||||
}
|
||||
|
||||
if (typeof onError === "function") {
|
||||
onError()
|
||||
}
|
||||
resolve(torrentInstance)
|
||||
})
|
||||
|
||||
return reject()
|
||||
torrentInstance.on("error", (error) => {
|
||||
progressBar.stop()
|
||||
clearInterval(progressInterval)
|
||||
|
||||
if (typeof onError === "function") {
|
||||
onError(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
|
||||
progressInterval = setInterval(() => {
|
||||
tickProgress.speed = torrentInstance.downloadSpeed
|
||||
tickProgress.transferred = torrentInstance.downloaded
|
||||
|
||||
tickProgress.transferredString = convertSize(tickProgress.transferred)
|
||||
tickProgress.totalString = convertSize(tickProgress.total)
|
||||
tickProgress.speedString = convertSize(tickProgress.speed)
|
||||
|
||||
if (typeof onProgress === "function") {
|
||||
onProgress(tickProgress)
|
||||
}
|
||||
|
||||
progressBar.update(tickProgress.transferred, {
|
||||
speed: tickProgress.speedString,
|
||||
})
|
||||
}, 1000)
|
||||
})
|
||||
})
|
||||
|
||||
await client.call("remove", downloadId)
|
||||
|
||||
if (taskId) {
|
||||
global._relic_eventBus.off(`task:cancel:${taskId}`, stopDownload)
|
||||
}
|
||||
|
||||
return downloadId
|
||||
}
|
0
packages/core/src/helpers/sendToRender.js
Executable file → Normal file
0
packages/core/src/helpers/sendToRender.js
Executable file → Normal file
2
packages/core/src/helpers/setup.js
Executable file → Normal file
2
packages/core/src/helpers/setup.js
Executable file → Normal file
@ -69,7 +69,7 @@ export default async () => {
|
||||
await fs.promises.mkdir(path.resolve(Vars.binaries_path, prerequisite.id), { recursive: true })
|
||||
|
||||
if (typeof prerequisite.url === "function") {
|
||||
prerequisite.url = await prerequisite.url(os.platform(), os.arch())
|
||||
prerequisite.url = await prerequisite.url(resolveOs(), os.arch())
|
||||
Log.info(`Resolved url: ${prerequisite.url}`)
|
||||
}
|
||||
|
||||
|
122
packages/core/src/index.js
Executable file → Normal file
122
packages/core/src/index.js
Executable file → Normal file
@ -4,7 +4,6 @@ import { onExit } from "signal-exit"
|
||||
import open from "open"
|
||||
|
||||
import SetupHelper from "./helpers/setup"
|
||||
import { execa } from "./libraries/execa"
|
||||
import Logger from "./logger"
|
||||
|
||||
import Settings from "./classes/Settings"
|
||||
@ -26,91 +25,66 @@ import PackageCheckUpdate from "./handlers/checkUpdate"
|
||||
import PackageLastOperationRetry from "./handlers/lastOperationRetry"
|
||||
|
||||
export default class RelicCore {
|
||||
constructor(params) {
|
||||
this.params = params
|
||||
}
|
||||
constructor(params) {
|
||||
this.params = params
|
||||
}
|
||||
|
||||
eventBus = (global._relic_eventBus = new EventEmitter())
|
||||
eventBus = global._relic_eventBus = new EventEmitter()
|
||||
|
||||
logger = Logger
|
||||
logger = Logger
|
||||
|
||||
db = DB
|
||||
db = DB
|
||||
|
||||
async initialize() {
|
||||
globalThis.relic_core = {
|
||||
tasks: [],
|
||||
vars: Vars,
|
||||
}
|
||||
async initialize() {
|
||||
globalThis.relic_core = {
|
||||
tasks: [],
|
||||
vars: Vars,
|
||||
}
|
||||
|
||||
console.log(`Checking runtime_path >`, Vars.runtime_path)
|
||||
await DB.initialize()
|
||||
|
||||
if (!fs.existsSync(Vars.runtime_path)) {
|
||||
fs.mkdirSync(Vars.runtime_path, { recursive: true })
|
||||
}
|
||||
await Settings.initialize()
|
||||
|
||||
await DB.initialize()
|
||||
if (!await Settings.get("packages_path")) {
|
||||
await Settings.set("packages_path", Vars.packages_path)
|
||||
}
|
||||
|
||||
await Settings.initialize()
|
||||
onExit(this.onExit)
|
||||
}
|
||||
|
||||
if (!(await Settings.get("packages_path"))) {
|
||||
await Settings.set("packages_path", Vars.packages_path)
|
||||
}
|
||||
onExit = () => {
|
||||
if (fs.existsSync(Vars.cache_path)) {
|
||||
fs.rmSync(Vars.cache_path, { recursive: true, force: true })
|
||||
}
|
||||
}
|
||||
|
||||
this.aria2c_instance = execa(
|
||||
Vars.aria2_bin,
|
||||
[
|
||||
"--enable-rpc",
|
||||
"--rpc-listen-all=true",
|
||||
"--rpc-allow-origin-all",
|
||||
"--file-allocation=none",
|
||||
],
|
||||
{
|
||||
stdout: "inherit",
|
||||
stderr: "inherit",
|
||||
},
|
||||
)
|
||||
async setup() {
|
||||
return await SetupHelper()
|
||||
}
|
||||
|
||||
onExit(this.onExit)
|
||||
}
|
||||
package = {
|
||||
install: PackageInstall,
|
||||
execute: PackageExecute,
|
||||
uninstall: PackageUninstall,
|
||||
reinstall: PackageReinstall,
|
||||
cancelInstall: PackageCancelInstall,
|
||||
update: PackageUpdate,
|
||||
apply: PackageApply,
|
||||
list: PackageList,
|
||||
read: PackageRead,
|
||||
authorize: PackageAuthorize,
|
||||
deauthorize: PackageDeauthorize,
|
||||
checkUpdate: PackageCheckUpdate,
|
||||
lastOperationRetry: PackageLastOperationRetry,
|
||||
}
|
||||
|
||||
onExit = () => {
|
||||
if (fs.existsSync(Vars.cache_path)) {
|
||||
fs.rmSync(Vars.cache_path, { recursive: true, force: true })
|
||||
}
|
||||
async openPath(pkg_id) {
|
||||
if (!pkg_id) {
|
||||
return open(Vars.runtime_path)
|
||||
}
|
||||
|
||||
if (this.aria2c_instance) {
|
||||
this.aria2c_instance.kill("SIGINT")
|
||||
}
|
||||
}
|
||||
const packagesPath = await Settings.get("packages_path") ?? Vars.packages_path
|
||||
|
||||
async setup() {
|
||||
return await SetupHelper()
|
||||
}
|
||||
|
||||
package = {
|
||||
install: PackageInstall,
|
||||
execute: PackageExecute,
|
||||
uninstall: PackageUninstall,
|
||||
reinstall: PackageReinstall,
|
||||
cancelInstall: PackageCancelInstall,
|
||||
update: PackageUpdate,
|
||||
apply: PackageApply,
|
||||
list: PackageList,
|
||||
read: PackageRead,
|
||||
authorize: PackageAuthorize,
|
||||
deauthorize: PackageDeauthorize,
|
||||
checkUpdate: PackageCheckUpdate,
|
||||
lastOperationRetry: PackageLastOperationRetry,
|
||||
}
|
||||
|
||||
async openPath(pkg_id) {
|
||||
if (!pkg_id) {
|
||||
return open(Vars.runtime_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
Executable file → Normal file
0
packages/core/src/libraries/execa/index.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/command.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/command.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/error.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/error.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/kill.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/kill.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/pipe.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/pipe.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/promise.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/promise.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/stdio.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/stdio.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/stream.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/stream.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/verbose.js
Executable file → Normal file
0
packages/core/src/libraries/execa/lib/verbose.js
Executable file → Normal file
0
packages/core/src/libraries/get-stream/array-buffer.js
Executable file → Normal file
0
packages/core/src/libraries/get-stream/array-buffer.js
Executable file → Normal file
0
packages/core/src/libraries/get-stream/array.js
Executable file → Normal file
0
packages/core/src/libraries/get-stream/array.js
Executable file → Normal file
0
packages/core/src/libraries/get-stream/buffer.js
Executable file → Normal file
0
packages/core/src/libraries/get-stream/buffer.js
Executable file → Normal file
0
packages/core/src/libraries/get-stream/contents.js
Executable file → Normal file
0
packages/core/src/libraries/get-stream/contents.js
Executable file → Normal file
0
packages/core/src/libraries/get-stream/index.js
Executable file → Normal file
0
packages/core/src/libraries/get-stream/index.js
Executable file → Normal file
0
packages/core/src/libraries/get-stream/string.js
Executable file → Normal file
0
packages/core/src/libraries/get-stream/string.js
Executable file → Normal file
0
packages/core/src/libraries/get-stream/utils.js
Executable file → Normal file
0
packages/core/src/libraries/get-stream/utils.js
Executable file → Normal file
0
packages/core/src/libraries/human-signals/core.js
Executable file → Normal file
0
packages/core/src/libraries/human-signals/core.js
Executable file → Normal file
0
packages/core/src/libraries/human-signals/index.js
Executable file → Normal file
0
packages/core/src/libraries/human-signals/index.js
Executable file → Normal file
0
packages/core/src/libraries/human-signals/realtime.js
Executable file → Normal file
0
packages/core/src/libraries/human-signals/realtime.js
Executable file → Normal file
0
packages/core/src/libraries/human-signals/signals.js
Executable file → Normal file
0
packages/core/src/libraries/human-signals/signals.js
Executable file → Normal file
0
packages/core/src/libraries/is-stream/index.js
Executable file → Normal file
0
packages/core/src/libraries/is-stream/index.js
Executable file → Normal file
0
packages/core/src/libraries/lowdb/adapters/Memory.js
Executable file → Normal file
0
packages/core/src/libraries/lowdb/adapters/Memory.js
Executable file → Normal file
0
packages/core/src/libraries/lowdb/adapters/node/DataFile.js
Executable file → Normal file
0
packages/core/src/libraries/lowdb/adapters/node/DataFile.js
Executable file → Normal file
0
packages/core/src/libraries/lowdb/adapters/node/JSONFile.js
Executable file → Normal file
0
packages/core/src/libraries/lowdb/adapters/node/JSONFile.js
Executable file → Normal file
0
packages/core/src/libraries/lowdb/adapters/node/TextFile.js
Executable file → Normal file
0
packages/core/src/libraries/lowdb/adapters/node/TextFile.js
Executable file → Normal file
0
packages/core/src/libraries/lowdb/core/Low.js
Executable file → Normal file
0
packages/core/src/libraries/lowdb/core/Low.js
Executable file → Normal file
0
packages/core/src/libraries/lowdb/presets/node.js
Executable file → Normal file
0
packages/core/src/libraries/lowdb/presets/node.js
Executable file → Normal file
0
packages/core/src/libraries/lowdb/steno/index.js
Executable file → Normal file
0
packages/core/src/libraries/lowdb/steno/index.js
Executable file → Normal file
0
packages/core/src/libraries/mimic-function/index.js
Executable file → Normal file
0
packages/core/src/libraries/mimic-function/index.js
Executable file → Normal file
0
packages/core/src/libraries/npm-run-path/index.js
Executable file → Normal file
0
packages/core/src/libraries/npm-run-path/index.js
Executable file → Normal file
0
packages/core/src/libraries/onetime/index.js
Executable file → Normal file
0
packages/core/src/libraries/onetime/index.js
Executable file → Normal file
0
packages/core/src/libraries/strip-final-newline/index.js
Executable file → Normal file
0
packages/core/src/libraries/strip-final-newline/index.js
Executable file → Normal file
0
packages/core/src/logger.js
Executable file → Normal file
0
packages/core/src/logger.js
Executable file → Normal file
0
packages/core/src/manifest/libraries.js
Executable file → Normal file
0
packages/core/src/manifest/libraries.js
Executable file → Normal file
0
packages/core/src/manifest/libs/auth/index.js
Executable file → Normal file
0
packages/core/src/manifest/libs/auth/index.js
Executable file → Normal file
@ -1,34 +0,0 @@
|
||||
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
Executable file → Normal file
32
packages/core/src/manifest/libs/fs/index.js
Executable file → Normal file
@ -36,36 +36,4 @@ export default class SecureFileSystem {
|
||||
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
Executable file → Normal file
4
packages/core/src/manifest/libs/index.js
Executable file → Normal file
@ -2,7 +2,6 @@ import Open from "./open"
|
||||
import Path from "./path"
|
||||
import Fs from "./fs"
|
||||
import Auth from "./auth"
|
||||
import Extract from "./extract"
|
||||
|
||||
// Third party libraries
|
||||
import Mcl from "./mcl"
|
||||
@ -12,6 +11,5 @@ export default {
|
||||
path: Path,
|
||||
open: Open,
|
||||
auth: Auth,
|
||||
extract: Extract,
|
||||
mcl: Mcl,
|
||||
mcl: Mcl
|
||||
}
|
0
packages/core/src/manifest/libs/mcl/authenticator.js
Executable file → Normal file
0
packages/core/src/manifest/libs/mcl/authenticator.js
Executable file → Normal file
0
packages/core/src/manifest/libs/mcl/handler.js
Executable file → Normal file
0
packages/core/src/manifest/libs/mcl/handler.js
Executable file → Normal file
0
packages/core/src/manifest/libs/mcl/index.js
Executable file → Normal file
0
packages/core/src/manifest/libs/mcl/index.js
Executable file → Normal file
0
packages/core/src/manifest/libs/mcl/launcher.js
Executable file → Normal file
0
packages/core/src/manifest/libs/mcl/launcher.js
Executable file → Normal file
0
packages/core/src/manifest/libs/open/index.js
Executable file → Normal file
0
packages/core/src/manifest/libs/open/index.js
Executable file → Normal file
0
packages/core/src/manifest/libs/path/index.js
Executable file → Normal file
0
packages/core/src/manifest/libs/path/index.js
Executable file → Normal file
0
packages/core/src/manifest/reader.js
Executable file → Normal file
0
packages/core/src/manifest/reader.js
Executable file → Normal file
0
packages/core/src/manifest/vm.js
Executable file → Normal file
0
packages/core/src/manifest/vm.js
Executable file → Normal file
25
packages/core/src/prerequisites.js
Executable file → Normal file
25
packages/core/src/prerequisites.js
Executable file → Normal file
@ -9,11 +9,9 @@ export default [
|
||||
{
|
||||
id: "7z-bin",
|
||||
finalBin: Vars.sevenzip_bin,
|
||||
url: resolveRemoteBinPath(`${baseURL}/7z-full`, "7z.zip"),
|
||||
destination: path.resolve(Vars.binaries_path, "7z.zip"),
|
||||
extract: path.resolve(Vars.binaries_path, "7z-bin"),
|
||||
url: resolveRemoteBinPath(`${baseURL}/7zip-bin`, process.platform === "win32" ? "7za.exe" : "7za"),
|
||||
destination: Vars.sevenzip_bin,
|
||||
rewriteExecutionPermission: true,
|
||||
deleteBeforeExtract: true,
|
||||
},
|
||||
{
|
||||
id: "git-bin",
|
||||
@ -26,13 +24,14 @@ export default [
|
||||
deleteBeforeExtract: true,
|
||||
},
|
||||
{
|
||||
id: "aria2",
|
||||
finalBin: Vars.aria2_bin,
|
||||
url: async (os, arch) => {
|
||||
return `https://storage.ragestudio.net/rstudio/binaries/aria2/${os}/${arch}/${os === "win32" ? "aria2c.exe" : "aria2c"}`
|
||||
},
|
||||
destination: Vars.aria2_bin,
|
||||
rewriteExecutionPermission: Vars.aria2_bin,
|
||||
id: "rclone-bin",
|
||||
finalBin: Vars.rclone_bin,
|
||||
url: resolveRemoteBinPath(`${baseURL}/rclone`, "rclone-bin.zip"),
|
||||
destination: path.resolve(Vars.binaries_path, "rclone-bin.zip"),
|
||||
extract: path.resolve(Vars.binaries_path, "rclone-bin"),
|
||||
requireOs: ["win32"],
|
||||
rewriteExecutionPermission: true,
|
||||
deleteBeforeExtract: true,
|
||||
},
|
||||
{
|
||||
id: "java22_jre_bin",
|
||||
@ -44,7 +43,7 @@ export default [
|
||||
params: {
|
||||
arch: arch,
|
||||
java_version: "22",
|
||||
os: os === "win32" ? "windows" : os,
|
||||
os: os,
|
||||
archive_type: "zip",
|
||||
javafx_bundled: "false",
|
||||
java_package_type: "jre",
|
||||
@ -78,7 +77,7 @@ export default [
|
||||
params: {
|
||||
arch: arch,
|
||||
java_version: "17",
|
||||
os: os === "win32" ? "windows" : os,
|
||||
os: os,
|
||||
archive_type: "zip",
|
||||
javafx_bundled: "false",
|
||||
java_package_type: "jre",
|
||||
|
0
packages/core/src/utils/chmodRecursive.js
Executable file → Normal file
0
packages/core/src/utils/chmodRecursive.js
Executable file → Normal file
0
packages/core/src/utils/extractFile.js
Executable file → Normal file
0
packages/core/src/utils/extractFile.js
Executable file → Normal file
0
packages/core/src/utils/parseStringVars.js
Executable file → Normal file
0
packages/core/src/utils/parseStringVars.js
Executable file → Normal file
0
packages/core/src/utils/readDirRecurse.js
Executable file → Normal file
0
packages/core/src/utils/readDirRecurse.js
Executable file → Normal file
0
packages/core/src/utils/resolveOs.js
Executable file → Normal file
0
packages/core/src/utils/resolveOs.js
Executable file → Normal file
4
packages/core/src/utils/resolveRemoteBinPath.js
Executable file → Normal file
4
packages/core/src/utils/resolveRemoteBinPath.js
Executable file → Normal file
@ -2,10 +2,10 @@ export default (pre, post) => {
|
||||
let url = null
|
||||
|
||||
if (process.platform === "darwin") {
|
||||
url = `${pre}/darwin/${process.arch}/${post}`
|
||||
url = `${pre}/mac/${process.arch}/${post}`
|
||||
}
|
||||
else if (process.platform === "win32") {
|
||||
url = `${pre}/win32/${process.arch}/${post}`
|
||||
url = `${pre}/win/${process.arch}/${post}`
|
||||
}
|
||||
else {
|
||||
url = `${pre}/linux/${process.arch}/${post}`
|
||||
|
0
packages/core/src/utils/resolveUserDataPath.js
Executable file → Normal file
0
packages/core/src/utils/resolveUserDataPath.js
Executable file → Normal file
63
packages/core/src/vars.js
Executable file → Normal file
63
packages/core/src/vars.js
Executable file → Normal file
@ -2,7 +2,7 @@ import path from "node:path"
|
||||
import upath from "upath"
|
||||
import resolveUserDataPath from "./utils/resolveUserDataPath"
|
||||
|
||||
const isWin = process.platform.includes("win32")
|
||||
const isWin = process.platform.includes("win")
|
||||
const isMac = process.platform.includes("darwin")
|
||||
|
||||
const runtimeName = "rs-relic"
|
||||
@ -11,57 +11,24 @@ const userdata_path = resolveUserDataPath()
|
||||
const runtime_path = upath.normalizeSafe(path.join(userdata_path, runtimeName))
|
||||
const cache_path = upath.normalizeSafe(path.join(runtime_path, "cache"))
|
||||
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 binaries = {
|
||||
sevenzip_bin: upath.normalizeSafe(
|
||||
path.resolve(binaries_path, "7z-bin", isWin ? "7za.exe" : "7z"),
|
||||
),
|
||||
git_bin: upath.normalizeSafe(
|
||||
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",
|
||||
),
|
||||
),
|
||||
sevenzip_bin: upath.normalizeSafe(path.resolve(binaries_path, "7z-bin", isWin ? "7za.exe" : "7za")),
|
||||
git_bin: upath.normalizeSafe(path.resolve(binaries_path, "git-bin", "bin", isWin ? "git.exe" : "git")),
|
||||
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")))),
|
||||
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 {
|
||||
runtimeName,
|
||||
db_path,
|
||||
userdata_path,
|
||||
runtime_path,
|
||||
cache_path,
|
||||
packages_path,
|
||||
binaries_path,
|
||||
...binaries,
|
||||
runtimeName,
|
||||
db_path,
|
||||
userdata_path,
|
||||
runtime_path,
|
||||
cache_path,
|
||||
packages_path,
|
||||
binaries_path,
|
||||
...binaries,
|
||||
}
|
4
packages/gui/electron-builder.yml
Executable file → Normal file
4
packages/gui/electron-builder.yml
Executable file → Normal file
@ -26,10 +26,10 @@ dmg:
|
||||
linux:
|
||||
target:
|
||||
- AppImage
|
||||
- snap
|
||||
- deb
|
||||
maintainer: ragestudio.net
|
||||
maintainer: electronjs.org
|
||||
category: Utility
|
||||
icon: resources/icon.png
|
||||
appImage:
|
||||
artifactName: ${productName}-${version}.${ext}
|
||||
npmRebuild: false
|
||||
|
0
packages/gui/electron.vite.config.js
Executable file → Normal file
0
packages/gui/electron.vite.config.js
Executable file → Normal file
107
packages/gui/package.json
Executable file → Normal file
107
packages/gui/package.json
Executable file → Normal file
@ -1,56 +1,55 @@
|
||||
{
|
||||
"name": "relic-gui",
|
||||
"version": "0.20.3",
|
||||
"description": "RageStudio Relic, yet another package manager.",
|
||||
"homepage": "https://relic.ragestudio.net",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "RageStudio",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"start": "electron-vite preview",
|
||||
"dev": "npm run build:core && electron-vite dev",
|
||||
"build": "npm run build:core && electron-vite build",
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
"pack:win": "electron-builder --win --config",
|
||||
"pack:mac": "electron-builder --mac --config",
|
||||
"pack:linux": "electron-builder --linux --config",
|
||||
"build:win": "npm run build && npm run pack:win",
|
||||
"build:mac": "npm run build && npm run pack:mac",
|
||||
"build:linux": "npm run build && npm run pack:linux",
|
||||
"build:core": "cd ../core && npm run build:swc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@electron-toolkit/preload": "^2.0.0",
|
||||
"@electron-toolkit/utils": "^2.0.0",
|
||||
"@getstation/electron-google-oauth2": "^14.0.0",
|
||||
"@imjs/electron-differential-updater": "^5.1.7",
|
||||
"@loadable/component": "^5.16.3",
|
||||
"@ragestudio/relic-core": "^0.20.3",
|
||||
"antd": "^5.13.2",
|
||||
"classnames": "^2.3.2",
|
||||
"electron-differential-updater": "^4.3.2",
|
||||
"electron-is-dev": "^2.0.0",
|
||||
"electron-store": "^8.1.0",
|
||||
"electron-updater": "^6.1.1",
|
||||
"got": "11.8.3",
|
||||
"human-format": "^1.2.0",
|
||||
"protocol-registry": "^1.4.1",
|
||||
"less": "^4.2.0",
|
||||
"lodash": "^4.17.21",
|
||||
"react-icons": "^4.11.0",
|
||||
"react-motion": "0.5.2",
|
||||
"react-router-dom": "6.6.2",
|
||||
"react-spinners": "^0.13.8",
|
||||
"react-spring": "^9.7.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ragestudio/hermes": "^0.1.1",
|
||||
"@vitejs/plugin-react": "^4.0.4",
|
||||
"electron": "25.6.0",
|
||||
"electron-builder": "24.6.3",
|
||||
"electron-vite": "^2.1.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"vite": "^4.4.9"
|
||||
}
|
||||
"name": "@ragestudio/relic-gui",
|
||||
"version": "0.19.1",
|
||||
"description": "RageStudio Relic, yet another package manager.",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "RageStudio",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"start": "electron-vite preview",
|
||||
"dev": "npm run build:core && electron-vite dev",
|
||||
"build": "npm run build:core && electron-vite build",
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
"pack:win": "electron-builder --win --config",
|
||||
"pack:mac": "electron-builder --mac --config",
|
||||
"pack:linux": "electron-builder --linux --config",
|
||||
"build:win": "npm run build && npm run pack:win",
|
||||
"build:mac": "npm run build && npm run pack:mac",
|
||||
"build:linux": "npm run build && npm run pack:linux",
|
||||
"build:core": "cd ../core && npm run build:swc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@electron-toolkit/preload": "^2.0.0",
|
||||
"@electron-toolkit/utils": "^2.0.0",
|
||||
"@getstation/electron-google-oauth2": "^14.0.0",
|
||||
"@imjs/electron-differential-updater": "^5.1.7",
|
||||
"@loadable/component": "^5.16.3",
|
||||
"@ragestudio/relic-core": "^0.19.1",
|
||||
"antd": "^5.13.2",
|
||||
"classnames": "^2.3.2",
|
||||
"electron-differential-updater": "^4.3.2",
|
||||
"electron-is-dev": "^2.0.0",
|
||||
"electron-store": "^8.1.0",
|
||||
"electron-updater": "^6.1.1",
|
||||
"got": "11.8.3",
|
||||
"human-format": "^1.2.0",
|
||||
"protocol-registry": "^1.4.1",
|
||||
"less": "^4.2.0",
|
||||
"lodash": "^4.17.21",
|
||||
"react-icons": "^4.11.0",
|
||||
"react-motion": "0.5.2",
|
||||
"react-router-dom": "6.6.2",
|
||||
"react-spinners": "^0.13.8",
|
||||
"react-spring": "^9.7.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ragestudio/hermes": "^0.1.1",
|
||||
"@vitejs/plugin-react": "^4.0.4",
|
||||
"electron": "25.6.0",
|
||||
"electron-builder": "24.6.3",
|
||||
"electron-vite": "^2.1.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"vite": "^4.4.9"
|
||||
}
|
||||
}
|
0
packages/gui/resources/icon.ico
Executable file → Normal file
0
packages/gui/resources/icon.ico
Executable file → Normal file
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 28 KiB |
0
packages/gui/resources/icon.svg
Executable file → Normal file
0
packages/gui/resources/icon.svg
Executable file → Normal file
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
0
packages/gui/src/main/classes/CoreAdapter.js
Executable file → Normal file
0
packages/gui/src/main/classes/CoreAdapter.js
Executable file → Normal file
0
packages/gui/src/main/index.js
Executable file → Normal file
0
packages/gui/src/main/index.js
Executable file → Normal 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