Use mixin for drive url

This commit is contained in:
Crimekillz 2024-04-06 03:09:26 +02:00
parent 96c8378209
commit e0f84d1ce6
5 changed files with 8 additions and 8 deletions

View File

@ -19,7 +19,7 @@ const ev = new Xev();
* Init process * Init process
*/ */
export default async function () { export default async function () {
process.title = `Iceshrimp (${cluster.isPrimary ? "master" : "worker"})`; process.title = `TrashPoss (${cluster.isPrimary ? "master" : "worker"})`;
if (cluster.isPrimary || envOption.disableClustering) { if (cluster.isPrimary || envOption.disableClustering) {
await masterMain(); await masterMain();
@ -42,7 +42,7 @@ export default async function () {
os.setPriority(10); os.setPriority(10);
} }
// For when Iceshrimp is started in a child process during unit testing. // For when TrashPoss is started in a child process during unit testing.
// Otherwise, process.send cannot be used, so start it. // Otherwise, process.send cannot be used, so start it.
if (process.send) { if (process.send) {
process.send("ok"); process.send("ok");

View File

@ -34,7 +34,7 @@ function greet() {
); );
} }
bootLogger.info(`Iceshrimp v${meta.version}, initializing...`, null, true); bootLogger.info(`TrashPoss v${meta.version}, initializing...`, null, true);
} }
/** /**
@ -56,7 +56,7 @@ export async function masterMain() {
process.exit(1); process.exit(1);
} }
bootLogger.succ("Iceshrimp initialized"); bootLogger.succ("TrashPoss initialized");
if (!envOption.disableClustering) { if (!envOption.disableClustering) {
await spawnWorkers(config.clusterLimit); await spawnWorkers(config.clusterLimit);

View File

@ -81,7 +81,7 @@ export default function load() {
mixin.apiUrl = `${mixin.scheme}://${mixin.host}/api`; mixin.apiUrl = `${mixin.scheme}://${mixin.host}/api`;
mixin.authUrl = `${mixin.scheme}://${mixin.host}/auth`; mixin.authUrl = `${mixin.scheme}://${mixin.host}/auth`;
mixin.driveUrl = `${mixin.scheme}://${mixin.host}/files`; mixin.driveUrl = `${mixin.scheme}://${mixin.host}/files`;
mixin.userAgent = `Iceshrimp/${meta.version} (${config.url})`; mixin.userAgent = `TrashPoss/${meta.version} (${config.url})`;
mixin.clientEntry = clientManifest["src/init.ts"]; mixin.clientEntry = clientManifest["src/init.ts"];
mixin.mediaDir = mediaDir ?? `${dir}/files`; mixin.mediaDir = mediaDir ?? `${dir}/files`;

View File

@ -15,13 +15,13 @@ export class InternalStorage {
public static saveFromPath(key: string, srcPath: string) { public static saveFromPath(key: string, srcPath: string) {
fs.mkdirSync(config.mediaDir, { recursive: true }); fs.mkdirSync(config.mediaDir, { recursive: true });
fs.copyFileSync(srcPath, InternalStorage.resolvePath(key)); fs.copyFileSync(srcPath, InternalStorage.resolvePath(key));
return `${config.url}/files/${key}`; return `${config.driveUrl}/${key}`;
} }
public static saveFromBuffer(key: string, data: Buffer) { public static saveFromBuffer(key: string, data: Buffer) {
fs.mkdirSync(config.mediaDir, { recursive: true }); fs.mkdirSync(config.mediaDir, { recursive: true });
fs.writeFileSync(InternalStorage.resolvePath(key), data); fs.writeFileSync(InternalStorage.resolvePath(key), data);
return `${config.url}/files/${key}`; return `${config.driveUrl}/${key}`;
} }
public static del(key: string) { public static del(key: string) {

View File

@ -22,7 +22,7 @@ export const lang = localStorage.getItem("lang");
export const langs = _LANGS_; export const langs = _LANGS_;
export const locale = JSON.parse(localStorage.getItem("locale")); export const locale = JSON.parse(localStorage.getItem("locale"));
export const version = _VERSION_; export const version = _VERSION_;
export const instanceName = siteName === "Iceshrimp" ? host : siteName; export const instanceName = siteName === "TrashPoss" ? host : siteName;
export let searchEngine = 'https://duckduckgo.com/?q='; export let searchEngine = 'https://duckduckgo.com/?q=';
export const ui = localStorage.getItem("ui"); export const ui = localStorage.getItem("ui");
export const debug = localStorage.getItem("debug") === "true"; export const debug = localStorage.getItem("debug") === "true";