Compare commits

..

No commits in common. "main" and "v0.19.1" have entirely different histories.

149 changed files with 243 additions and 424 deletions

0
.github/workflows/release.yml vendored Executable file → Normal file
View File

0
.gitignore vendored Executable file → Normal file
View File

4
package.json Executable file → Normal file
View 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
View File

0
packages/cli/package.json Executable file → Normal file
View File

0
packages/cli/src/index.js Executable file → Normal file
View File

0
packages/core/.swcrc Executable file → Normal file
View File

3
packages/core/package.json Executable file → Normal file
View File

@ -1,6 +1,6 @@
{
"name": "@ragestudio/relic-core",
"version": "0.20.3",
"version": "0.19.1",
"license": "MIT",
"author": "RageStudio",
"description": "RageStudio Relic, yet another package manager.",
@ -16,7 +16,6 @@
"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",

0
packages/core/src/classes/ManifestAuthDB.js Executable file → Normal file
View File

0
packages/core/src/classes/ManifestConfig.js Executable file → Normal file
View File

0
packages/core/src/classes/PatchManager.js Executable file → Normal file
View File

0
packages/core/src/classes/Settings.js Executable file → Normal file
View File

0
packages/core/src/db.js Executable file → Normal file
View File

0
packages/core/src/generic_steps/git_clone.js Executable file → Normal file
View File

0
packages/core/src/generic_steps/git_pull.js Executable file → Normal file
View File

0
packages/core/src/generic_steps/git_reset.js Executable file → Normal file
View File

0
packages/core/src/generic_steps/http.js Executable file → Normal file
View File

0
packages/core/src/generic_steps/index.js Executable file → Normal file
View File

10
packages/core/src/generic_steps/torrent.js Executable file → Normal file
View 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
View File

0
packages/core/src/handlers/authorize.js Executable file → Normal file
View File

4
packages/core/src/handlers/cancelInstall.js Executable file → Normal file
View 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
View File

0
packages/core/src/handlers/deauthorize.js Executable file → Normal file
View File

0
packages/core/src/handlers/execute.js Executable file → Normal file
View File

4
packages/core/src/handlers/install.js Executable file → Normal file
View 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
View File

0
packages/core/src/handlers/list.js Executable file → Normal file
View File

0
packages/core/src/handlers/read.js Executable file → Normal file
View File

0
packages/core/src/handlers/reinstall.js Executable file → Normal file
View File

0
packages/core/src/handlers/uninstall.js Executable file → Normal file
View File

0
packages/core/src/handlers/update.js Executable file → Normal file
View File

0
packages/core/src/helpers/downloadHttpFile.js Executable file → Normal file
View File

137
packages/core/src/helpers/downloadTorrent.js Executable file → Normal file
View 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,54 +30,51 @@ 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 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)
if (typeof onStart === "function") {
onStart(torrentInstance)
}
progressBar.start(tickProgress.total, 0, {
speed: "0B/s",
total_formatted: tickProgress.totalString,
})
await client.open()
let downloadId = await client.call(
"addUri",
[magnet],
{
dir: destination,
},
)
async function stopDownload() {
await client.call("remove", downloadId)
torrentInstance.on("done", () => {
progressBar.stop()
clearInterval(progressInterval)
if (typeof onDone === "function") {
onDone(torrentInstance)
}
await new Promise(async (resolve, reject) => {
if (typeof onStart === "function") {
onStart()
resolve(torrentInstance)
})
torrentInstance.on("error", (error) => {
progressBar.stop()
clearInterval(progressInterval)
if (typeof onError === "function") {
onError(error)
} else {
reject(error)
}
})
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]
}
}
tickProgress.total = parseInt(data.totalLength)
tickProgress.speed = parseInt(data.downloadSpeed)
tickProgress.transferred = parseInt(data.completedLength)
tickProgress.connections = data.connections
progressInterval = setInterval(() => {
tickProgress.speed = torrentInstance.downloadSpeed
tickProgress.transferred = torrentInstance.downloaded
tickProgress.transferredString = convertSize(tickProgress.transferred)
tickProgress.totalString = convertSize(tickProgress.total)
@ -85,56 +83,11 @@ export default async function downloadTorrent(
if (typeof onProgress === "function") {
onProgress(tickProgress)
}
progressBar.update(tickProgress.transferred, {
speed: tickProgress.speedString,
})
}, 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 Executable file → Normal file
View File

2
packages/core/src/helpers/setup.js Executable file → Normal file
View 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}`)
}

32
packages/core/src/index.js Executable file → Normal file
View 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"
@ -30,7 +29,7 @@ export default class RelicCore {
this.params = params
}
eventBus = (global._relic_eventBus = new EventEmitter())
eventBus = global._relic_eventBus = new EventEmitter()
logger = Logger
@ -42,34 +41,14 @@ export default class RelicCore {
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 Settings.initialize()
if (!(await Settings.get("packages_path"))) {
if (!await Settings.get("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)
}
@ -77,10 +56,6 @@ export default class RelicCore {
if (fs.existsSync(Vars.cache_path)) {
fs.rmSync(Vars.cache_path, { recursive: true, force: true })
}
if (this.aria2c_instance) {
this.aria2c_instance.kill("SIGINT")
}
}
async setup() {
@ -108,8 +83,7 @@ export default class RelicCore {
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)
}

0
packages/core/src/libraries/execa/index.js Executable file → Normal file
View File

0
packages/core/src/libraries/execa/lib/command.js Executable file → Normal file
View File

0
packages/core/src/libraries/execa/lib/error.js Executable file → Normal file
View File

0
packages/core/src/libraries/execa/lib/kill.js Executable file → Normal file
View File

0
packages/core/src/libraries/execa/lib/pipe.js Executable file → Normal file
View File

0
packages/core/src/libraries/execa/lib/promise.js Executable file → Normal file
View File

0
packages/core/src/libraries/execa/lib/stdio.js Executable file → Normal file
View File

0
packages/core/src/libraries/execa/lib/stream.js Executable file → Normal file
View File

0
packages/core/src/libraries/execa/lib/verbose.js Executable file → Normal file
View File

0
packages/core/src/libraries/get-stream/array-buffer.js Executable file → Normal file
View File

0
packages/core/src/libraries/get-stream/array.js Executable file → Normal file
View File

0
packages/core/src/libraries/get-stream/buffer.js Executable file → Normal file
View File

0
packages/core/src/libraries/get-stream/contents.js Executable file → Normal file
View File

0
packages/core/src/libraries/get-stream/index.js Executable file → Normal file
View File

0
packages/core/src/libraries/get-stream/string.js Executable file → Normal file
View File

0
packages/core/src/libraries/get-stream/utils.js Executable file → Normal file
View File

0
packages/core/src/libraries/human-signals/core.js Executable file → Normal file
View File

0
packages/core/src/libraries/human-signals/index.js Executable file → Normal file
View File

0
packages/core/src/libraries/human-signals/realtime.js Executable file → Normal file
View File

0
packages/core/src/libraries/human-signals/signals.js Executable file → Normal file
View File

0
packages/core/src/libraries/is-stream/index.js Executable file → Normal file
View File

0
packages/core/src/libraries/lowdb/adapters/Memory.js Executable file → Normal file
View File

View File

View File

View File

0
packages/core/src/libraries/lowdb/core/Low.js Executable file → Normal file
View File

0
packages/core/src/libraries/lowdb/presets/node.js Executable file → Normal file
View File

0
packages/core/src/libraries/lowdb/steno/index.js Executable file → Normal file
View File

0
packages/core/src/libraries/mimic-function/index.js Executable file → Normal file
View File

0
packages/core/src/libraries/npm-run-path/index.js Executable file → Normal file
View File

0
packages/core/src/libraries/onetime/index.js Executable file → Normal file
View File

View File

0
packages/core/src/logger.js Executable file → Normal file
View File

0
packages/core/src/manifest/libraries.js Executable file → Normal file
View File

0
packages/core/src/manifest/libs/auth/index.js Executable file → Normal file
View File

View 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
View 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
View 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
View File

0
packages/core/src/manifest/libs/mcl/handler.js Executable file → Normal file
View File

0
packages/core/src/manifest/libs/mcl/index.js Executable file → Normal file
View File

0
packages/core/src/manifest/libs/mcl/launcher.js Executable file → Normal file
View File

0
packages/core/src/manifest/libs/open/index.js Executable file → Normal file
View File

0
packages/core/src/manifest/libs/path/index.js Executable file → Normal file
View File

0
packages/core/src/manifest/reader.js Executable file → Normal file
View File

0
packages/core/src/manifest/vm.js Executable file → Normal file
View File

25
packages/core/src/prerequisites.js Executable file → Normal file
View 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
View File

0
packages/core/src/utils/extractFile.js Executable file → Normal file
View File

0
packages/core/src/utils/parseStringVars.js Executable file → Normal file
View File

0
packages/core/src/utils/readDirRecurse.js Executable file → Normal file
View File

0
packages/core/src/utils/resolveOs.js Executable file → Normal file
View File

4
packages/core/src/utils/resolveRemoteBinPath.js Executable file → Normal file
View 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
View File

47
packages/core/src/vars.js Executable file → Normal file
View 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,48 +11,15 @@ 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 {

4
packages/gui/electron-builder.yml Executable file → Normal file
View 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
View File

7
packages/gui/package.json Executable file → Normal file
View File

@ -1,8 +1,7 @@
{
"name": "relic-gui",
"version": "0.20.3",
"name": "@ragestudio/relic-gui",
"version": "0.19.1",
"description": "RageStudio Relic, yet another package manager.",
"homepage": "https://relic.ragestudio.net",
"main": "./out/main/index.js",
"author": "RageStudio",
"license": "MIT",
@ -25,7 +24,7 @@
"@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",
"@ragestudio/relic-core": "^0.19.1",
"antd": "^5.13.2",
"classnames": "^2.3.2",
"electron-differential-updater": "^4.3.2",

0
packages/gui/resources/icon.ico Executable file → Normal file
View 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
View 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
View File

0
packages/gui/src/main/index.js Executable file → Normal file
View File

Some files were not shown because too many files have changed in this diff Show More