mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-13 08:48:26 +00:00
Replace Cobalt branding with random element names
This commit is contained in:
parent
c48c64240b
commit
131cc2eb3c
@ -9,12 +9,14 @@ import { fileURLToPath } from "url";
|
||||
import { env, isCluster } from "./config.js"
|
||||
import { Red } from "./misc/console-text.js";
|
||||
import { initCluster } from "./misc/cluster.js";
|
||||
import { randomizeName } from "./misc/randomize-name.js";
|
||||
|
||||
const app = express();
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename).slice(0, -4);
|
||||
|
||||
randomizeName();
|
||||
app.disable("x-powered-by");
|
||||
|
||||
if (env.apiURL) {
|
||||
|
@ -55,7 +55,7 @@ const env = {
|
||||
}
|
||||
|
||||
const genericUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
|
||||
const cobaltUserAgent = `cobalt/${version} (+https://github.com/imputnet/cobalt)`;
|
||||
const nickelZincGalliumUserAgent = `nickelZincGallium/${version} (+https://github.com/imputnet/nickelZincGallium)`;
|
||||
|
||||
export const setTunnelPort = (port) => env.tunnelPort = port;
|
||||
export const isCluster = env.instanceCount > 1;
|
||||
@ -77,5 +77,5 @@ if (env.instanceCount > 1 && !env.redisURL) {
|
||||
export {
|
||||
env,
|
||||
genericUserAgent,
|
||||
cobaltUserAgent,
|
||||
nickelZincGalliumUserAgent,
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import { verifyStream, getInternalStream } from "../stream/manage.js";
|
||||
import { createResponse, normalizeRequest, getIP } from "../processing/request.js";
|
||||
import * as APIKeys from "../security/api-keys.js";
|
||||
import * as Cookies from "../processing/cookie/manager.js";
|
||||
import { randomizeName } from "../misc/randomize-name.js";
|
||||
|
||||
const git = {
|
||||
branch: await getBranch(),
|
||||
@ -45,8 +46,9 @@ export const runAPI = async (express, app, __dirname, isPrimary = true) => {
|
||||
const startTime = new Date();
|
||||
const startTimestamp = startTime.getTime();
|
||||
|
||||
randomizeName();
|
||||
const serverInfo = JSON.stringify({
|
||||
cobalt: {
|
||||
nickelZincGallium: {
|
||||
version: version,
|
||||
url: env.apiURL,
|
||||
startTime: `${startTimestamp}`,
|
||||
@ -354,7 +356,7 @@ export const runAPI = async (express, app, __dirname, isPrimary = true) => {
|
||||
}, () => {
|
||||
if (isPrimary) {
|
||||
console.log(`\n` +
|
||||
Bright(Cyan("cobalt ")) + Bright("API ^ω^") + "\n" +
|
||||
Bright(Cyan("nickelZincGallium ")) + Bright("API ^ω^") + "\n" +
|
||||
|
||||
"~~~~~~\n" +
|
||||
Bright("version: ") + version + "\n" +
|
||||
@ -387,7 +389,7 @@ export const runAPI = async (express, app, __dirname, isPrimary = true) => {
|
||||
exclusive: true
|
||||
}, () => {
|
||||
const { port } = server.address();
|
||||
console.log(`${Green('[✓]')} cobalt sub-instance running on 127.0.0.1:${port}`);
|
||||
console.log(`${Green('[✓]')} nickelZincGallium sub-instance running on 127.0.0.1:${port}`);
|
||||
setTunnelPort(port);
|
||||
});
|
||||
}
|
||||
|
6
api/src/misc/randomize-name.js
Normal file
6
api/src/misc/randomize-name.js
Normal file
@ -0,0 +1,6 @@
|
||||
const names = ['nickel', 'zinc', 'gallium', 'silicon', 'copper', 'aluminium', 'calcium', 'magnesium', 'titanium'];
|
||||
|
||||
export function randomizeName() {
|
||||
const randomIndex = Math.floor(Math.random() * names.length);
|
||||
return names[randomIndex];
|
||||
}
|
@ -10,7 +10,7 @@ import cachedInfo from "$lib/state/server-info";
|
||||
import { getServerInfo } from "$lib/api/server-info";
|
||||
|
||||
import type { Optional } from "$lib/types/generic";
|
||||
import type { CobaltAPIResponse, CobaltErrorResponse } from "$lib/types/api";
|
||||
import type { NickelZincGalliumAPIResponse, NickelZincGalliumErrorResponse } from "$lib/types/api";
|
||||
|
||||
const getAuthorization = async () => {
|
||||
const processing = get(settings).processing;
|
||||
@ -22,7 +22,7 @@ const getAuthorization = async () => {
|
||||
error: {
|
||||
code: "error.captcha_ongoing"
|
||||
}
|
||||
} as CobaltErrorResponse;
|
||||
} as NickelZincGalliumErrorResponse;
|
||||
}
|
||||
|
||||
const session = await getSession();
|
||||
@ -78,7 +78,7 @@ const request = async (url: string) => {
|
||||
error: {
|
||||
code: "error.api.unreachable"
|
||||
}
|
||||
} as CobaltErrorResponse;
|
||||
} as NickelZincGalliumErrorResponse;
|
||||
}
|
||||
|
||||
const api = currentApiURL();
|
||||
@ -96,7 +96,7 @@ const request = async (url: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
const response: Optional<CobaltAPIResponse> = await fetch(api, {
|
||||
const response: Optional<NickelZincGalliumAPIResponse> = await fetch(api, {
|
||||
method: "POST",
|
||||
redirect: "manual",
|
||||
signal: AbortSignal.timeout(20000),
|
||||
@ -115,14 +115,14 @@ const request = async (url: string) => {
|
||||
error: {
|
||||
code: "error.api.timed_out"
|
||||
}
|
||||
} as CobaltErrorResponse;
|
||||
} as NickelZincGalliumErrorResponse;
|
||||
}
|
||||
});
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
const probeCobaltTunnel = async (url: string) => {
|
||||
const probeNickelZincGalliumTunnel = async (url: string) => {
|
||||
const request = await fetch(`${url}&p=1`).catch(() => {});
|
||||
if (request?.status === 200) {
|
||||
return request?.status;
|
||||
@ -132,5 +132,5 @@ const probeCobaltTunnel = async (url: string) => {
|
||||
|
||||
export default {
|
||||
request,
|
||||
probeCobaltTunnel,
|
||||
probeNickelZincGalliumTunnel,
|
||||
}
|
||||
|
@ -4,17 +4,17 @@ import { get } from "svelte/store";
|
||||
import { currentApiURL } from "$lib/api/api-url";
|
||||
import { turnstileCreated, turnstileEnabled, turnstileSolved } from "$lib/state/turnstile";
|
||||
import cachedInfo from "$lib/state/server-info";
|
||||
import type { CobaltServerInfoResponse, CobaltErrorResponse, CobaltServerInfo } from "$lib/types/api";
|
||||
import type { NickelZincGalliumServerInfoResponse, NickelZincGalliumErrorResponse, NickelZincGalliumServerInfo } from "$lib/types/api";
|
||||
|
||||
export type CobaltServerInfoCache = {
|
||||
info: CobaltServerInfo,
|
||||
export type NickelZincGalliumServerInfoCache = {
|
||||
info: NickelZincGalliumServerInfo,
|
||||
origin: string,
|
||||
}
|
||||
|
||||
const request = async () => {
|
||||
const apiEndpoint = `${currentApiURL()}/`;
|
||||
|
||||
const response: CobaltServerInfoResponse = await fetch(apiEndpoint, {
|
||||
const response: NickelZincGalliumServerInfoResponse = await fetch(apiEndpoint, {
|
||||
redirect: "manual",
|
||||
signal: AbortSignal.timeout(10000),
|
||||
})
|
||||
@ -26,7 +26,7 @@ const request = async () => {
|
||||
error: {
|
||||
code: "error.api.timed_out"
|
||||
}
|
||||
} as CobaltErrorResponse
|
||||
} as NickelZincGalliumErrorResponse
|
||||
}
|
||||
});
|
||||
|
||||
@ -50,7 +50,7 @@ export const getServerInfo = async () => {
|
||||
|
||||
const freshInfo = await request();
|
||||
|
||||
if (!freshInfo || !("cobalt" in freshInfo)) {
|
||||
if (!freshInfo || !("nickelZincGallium" in freshInfo)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ export const getServerInfo = async () => {
|
||||
});
|
||||
|
||||
// reload the page if turnstile sitekey changed
|
||||
if (browser && get(turnstileEnabled) && cache && cache?.info?.cobalt?.turnstileSitekey !== freshInfo?.cobalt?.turnstileSitekey) {
|
||||
if (browser && get(turnstileEnabled) && cache && cache?.info?.nickelZincGallium?.turnstileSitekey !== freshInfo?.nickelZincGallium?.turnstileSitekey) {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
|
@ -18,14 +18,14 @@ const variables = {
|
||||
|
||||
const contacts = {
|
||||
discord: "https://discord.gg/pQPt8HBUPu",
|
||||
twitter: "https://x.com/justusecobalt",
|
||||
github: "https://github.com/imputnet/cobalt",
|
||||
bluesky: "https://bsky.app/profile/cobalt.tools",
|
||||
telegram_ru: "https://t.me/justusecobalt_ru",
|
||||
twitter: "https://x.com/justusenickelZincGallium",
|
||||
github: "https://github.com/imputnet/nickelZincGallium",
|
||||
bluesky: "https://bsky.app/profile/nickelZincGallium.tools",
|
||||
telegram_ru: "https://t.me/justusenickelZincGallium_ru",
|
||||
}
|
||||
|
||||
const partners = {
|
||||
royalehosting: "https://royalehosting.net/?partner=cobalt",
|
||||
royalehosting: "https://royalehosting.net/?partner=nickelZincGallium",
|
||||
}
|
||||
|
||||
const donate = {
|
||||
@ -50,12 +50,12 @@ const siriShortcuts = {
|
||||
};
|
||||
|
||||
const docs = {
|
||||
instanceHosting: "https://github.com/imputnet/cobalt/blob/main/docs/run-an-instance.md",
|
||||
webLicense: "https://github.com/imputnet/cobalt/blob/main/web/LICENSE",
|
||||
apiLicense: "https://github.com/imputnet/cobalt/blob/main/api/LICENSE",
|
||||
instanceHosting: "https://github.com/imputnet/nickelZincGallium/blob/main/docs/run-an-instance.md",
|
||||
webLicense: "https://github.com/imputnet/nickelZincGallium/blob/main/web/LICENSE",
|
||||
apiLicense: "https://github.com/imputnet/nickelZincGallium/blob/main/api/LICENSE",
|
||||
};
|
||||
|
||||
const defaultApiURL = "https://api.cobalt.tools";
|
||||
const defaultApiURL = "https://api.nickelZincGallium.tools";
|
||||
|
||||
export { donate, defaultApiURL, contacts, partners, siriShortcuts, docs };
|
||||
export default variables;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { defaultLocale } from "$lib/i18n/translations";
|
||||
import type { CobaltSettings } from "$lib/types/settings";
|
||||
import type { NickelZincGalliumSettings } from "$lib/types/settings";
|
||||
|
||||
const defaultSettings: CobaltSettings = {
|
||||
const defaultSettings: NickelZincGalliumSettings = {
|
||||
schemaVersion: 4,
|
||||
advanced: {
|
||||
debug: false,
|
||||
|
@ -7,14 +7,14 @@
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>{$t("general.cobalt")}</title>
|
||||
<meta property="og:title" content={$t("general.cobalt")} />
|
||||
<title>{$t("general.nickelZincGallium")}</title>
|
||||
<meta property="og:title" content={$t("general.nickelZincGallium")} />
|
||||
</svelte:head>
|
||||
|
||||
<div id="cobalt-save-container" class="center-column-container">
|
||||
<div id="nickelZincGallium-save-container" class="center-column-container">
|
||||
<SupportedServices />
|
||||
<main
|
||||
id="cobalt-save"
|
||||
id="nickelZincGallium-save"
|
||||
tabindex="-1"
|
||||
data-first-focus
|
||||
data-focus-ring-hidden
|
||||
@ -29,12 +29,12 @@
|
||||
</div>
|
||||
|
||||
<style>
|
||||
#cobalt-save-container {
|
||||
#nickelZincGallium-save-container {
|
||||
padding: var(--padding);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#cobalt-save {
|
||||
#nickelZincGallium-save {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
@ -54,7 +54,7 @@
|
||||
}
|
||||
|
||||
@media screen and (max-width: 535px) {
|
||||
#cobalt-save-container {
|
||||
#nickelZincGallium-save-container {
|
||||
padding-top: calc(var(--padding) / 2);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user