[i18n-2] i18n rewrite - core done

pull/48/head
Oj18 3 years ago
parent a8720fe0e6
commit 986c6a2260

@ -0,0 +1,18 @@
import sleep from '../src/util/sleep';
const init = async () => {
while (!window.webpackJsonp?.push) {
await sleep(10);
}
const wpRequire = window.webpackJsonp.push([[], { get_require: (mod, _exports, wpRequire) => mod.exports = wpRequire }, [["get_require"]]]);
const locale = Object.keys(wpRequire.c).map((x) => wpRequire.c[x].exports).find((x) => x?.default?.getLocaleInfo).default.getLocale();
console.log('[GooseMod Bootstrap]', 'Found locale', locale);
// eval(await (await fetch(`http://localhost:1234/goosemod.${locale}.js`)).text());
eval(await (await fetch(`https://raw.githubusercontent.com/GooseMod/GooseMod/dist-dev/goosemod.${locale}.js`)).text());
};
init();
//# sourceURL=GooseMod%20Bootstrap

@ -0,0 +1,226 @@
{
"en-US": {
"name": "English, US",
"englishName": "English, US",
"code": "en-US",
"postgresLang": "english",
"enabled": true
},
"en-GB": {
"name": "English, UK",
"englishName": "English, UK",
"code": "en-GB",
"postgresLang": "english",
"enabled": true
},
"zh-CN": {
"name": "中文",
"englishName": "Chinese Simplified",
"code": "zh-CN",
"postgresLang": "simple",
"enabled": true
},
"zh-TW": {
"name": "繁體中文",
"englishName": "Traditional Chinese",
"code": "zh-TW",
"postgresLang": "simple",
"enabled": true
},
"cs": {
"name": "Čeština",
"englishName": "Czech",
"code": "cs",
"postgresLang": "simple",
"enabled": true
},
"da": {
"name": "Dansk",
"englishName": "Danish",
"code": "da",
"postgresLang": "danish",
"enabled": true
},
"nl": {
"name": "Nederlands",
"englishName": "Dutch",
"code": "nl",
"postgresLang": "dutch",
"enabled": true
},
"fr": {
"name": "Français",
"englishName": "French",
"code": "fr",
"postgresLang": "french",
"enabled": true
},
"de": {
"name": "Deutsch",
"englishName": "German",
"code": "de",
"postgresLang": "german",
"enabled": true
},
"el": {
"name": "Ελληνικά",
"englishName": "Greek",
"code": "el",
"postgresLang": "simple",
"enabled": true
},
"hu": {
"name": "Magyar",
"englishName": "Hungarian",
"code": "hu",
"postgresLang": "hungarian",
"enabled": true
},
"it": {
"name": "Italiano",
"englishName": "Italian",
"code": "it",
"postgresLang": "italian",
"enabled": true
},
"ja": {
"name": "日本語",
"englishName": "Japanese",
"code": "ja",
"postgresLang": "simple",
"enabled": true
},
"ko": {
"name": "한국어",
"englishName": "Korean",
"code": "ko",
"postgresLang": "simple",
"enabled": true
},
"pl": {
"name": "Polski",
"englishName": "Polish",
"code": "pl",
"postgresLang": "simple",
"enabled": true
},
"pt-PT": {
"name": "Português",
"englishName": "Portuguese",
"code": "pt-PT",
"postgresLang": "portuguese",
"enabled": false
},
"pt-BR": {
"name": "Português do Brasil",
"englishName": "Portuguese, Brazilian",
"code": "pt-BR",
"postgresLang": "portuguese",
"enabled": true
},
"ru": {
"name": "Русский",
"englishName": "Russian",
"code": "ru",
"postgresLang": "russian",
"enabled": true
},
"sk": {
"name": "Slovenčina",
"englishName": "Slovak",
"code": "sk",
"postgresLang": "simple",
"enabled": false
},
"es-ES": {
"name": "Español",
"englishName": "Spanish",
"code": "es-ES",
"postgresLang": "spanish",
"enabled": true
},
"sv-SE": {
"name": "Svenska",
"englishName": "Swedish",
"code": "sv-SE",
"postgresLang": "swedish",
"enabled": true
},
"tr": {
"name": "Türkçe",
"englishName": "Turkish",
"code": "tr",
"postgresLang": "turkish",
"enabled": true
},
"bg": {
"name": "български",
"englishName": "Bulgarian",
"code": "bg",
"postgresLang": "simple",
"enabled": true
},
"uk": {
"name": "Українська",
"englishName": "Ukrainian",
"code": "uk",
"postgresLang": "simple",
"enabled": true
},
"fi": {
"name": "Suomi",
"englishName": "Finnish",
"code": "fi",
"postgresLang": "finnish",
"enabled": true
},
"no": {
"name": "Norsk",
"englishName": "Norwegian",
"code": "no",
"postgresLang": "norwegian",
"enabled": true
},
"hr": {
"name": "Hrvatski",
"englishName": "Croatian",
"code": "hr",
"postgresLang": "simple",
"enabled": true
},
"ro": {
"name": "Română",
"englishName": "Romanian",
"code": "ro",
"postgresLang": "romanian",
"enabled": true
},
"lt": {
"name": "Lietuviškai",
"englishName": "Lithuanian",
"code": "lt",
"postgresLang": "simple",
"enabled": true
},
"th": {
"name": "ไทย",
"englishName": "Thai",
"code": "th",
"postgresLang": "simple",
"enabled": true
},
"vi": {
"name": "Tiếng Việt",
"englishName": "Vietnamese",
"code": "vi",
"postgresLang": "simple",
"enabled": true
},
"hi": {
"name": "हिंदी",
"englishName": "Hindi",
"code": "hi",
"postgresLang": "simple",
"enabled": true
}
}

@ -0,0 +1,104 @@
{
"terms": {
"goosemod": {
"store": "GooseMod Store",
"settings": "GooseMod Settings",
"modules": "GooseMod Modules"
},
"add": "Add",
"remove": "Remove",
"refresh": "Refresh",
"settings": "Settings",
"changelog": "Change Log",
"store": {
"store": "Store",
"themes": "Themes",
"plugins": "Plugins",
"snippets": "Snippets",
"modules": "Modules",
"repos": "Repos",
"developers": "Developers"
}
},
"store": {
"options": {
"tabs": {
"store": "Store",
"imported": "Imported"
},
"search": {
"placeholder": {
"themes": "Search Themes",
"plugins": "Search Plugins"
}
},
"sort": {
"label": "Sort by",
"stars": "Stars",
"az": "A-Z",
"last_updated": "Last Updated"
},
"author": {
"label": "Author",
"all": "All"
}
},
"categories": {
"top_starred": "Top Starred",
"recently_updated": "Recently Updated",
"upcoming": "Upcoming",
"all": {
"themes": "All Themes",
"plugins": "All Plugins"
}
},
"pgp": {
"verified": "PGP Verified",
"untrusted": "PGP Untrusted",
"unknown": "No PGP"
}
},
"modals": {
"external_repo_security": {
"main": "External repos pose security risks as they are not controlled by GooseMod developers. We are not responsible for any dangers because of external repos added by users.\n\nIf you do not trust the owner of this repo do not use it as it could compromise your Discord install.\n\nPlease confirm adding this repo by pressing OK.",
"bad_pgp": "This repo is not known or trusted (no PGP verification), please be extra careful. Make sure you trust the owner(s) of this repo completely.\n\nTo solve this issue ask the repo maintainer to add PGP support.\n\nPlease reconfirm adding this repo by pressing OK."
}
},
"toasts": {
},
"settings": {
},
"ootb": {
},
"badges": {
"sponsor": "GooseMod Sponsor",
"translator": "GooseMod Translator",
"developer": "GooseMod Developer",
"guild": "GooseMod Official Discord"
}
}

@ -0,0 +1,61 @@
import { readFileSync, writeFileSync, existsSync } from 'fs';
import langs from '../i18n/langs.json';
import { join, resolve, dirname } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const distDir = resolve(join(__dirname, '..', '..', 'dist'));
const translationsDir = resolve(join(__dirname, '..', 'i18n', 'translations'));
const getTranslation = (lang) => {
const path = join(translationsDir, lang + '.json');
if (!existsSync(path)) return false;
return JSON.parse(readFileSync(path, 'utf8'));
};
const flattenObj = (obj, key = '') => Object.keys(obj).reduce((acc, x) => {
const k = (key ? key + '.' : '') + x;
if (typeof obj[x] === 'object') {
const f = flattenObj(obj[x], k);
for (const y of Object.keys(f)) {
acc[y] = f[y];
}
} else {
acc[k] = obj[x];
}
return acc;
}, {});
export default (code) => {
const defaultTranslation = getTranslation('en-US');
for (const lang of Object.keys(langs)) {
const outPath = join(distDir, 'goosemod.' + lang + '.js');
const translation = {
...defaultTranslation,
...(getTranslation(lang) || {})
};
let langCode = code;
const flatTranslation = flattenObj(translation);
console.log(flatTranslation);
for (const key in flatTranslation) {
const val = flatTranslation[key].replaceAll('\n', '\\n');
langCode = langCode.replaceAll(`#${key}#`, val);
}
writeFileSync(outPath, langCode);
}
};

@ -1,6 +1,7 @@
import { exec } from 'child_process';
import genChangelog from './genChangelog';
import geni18nFiles from './i18n';
export default () => {
@ -12,9 +13,13 @@ export default () => {
renderChunk: async (code) => {
const commitHash = await new Promise((res) => exec(`git rev-parse HEAD`, (_err, stdout) => res(stdout.trim())));
return code
code = code
.replace('<changelog>', changelog)
.replace('<hash>', commitHash) + '//# sourceURL=GooseMod';
geni18nFiles(code);
return code;
}
}
};

@ -7,33 +7,56 @@ const prod = !process.env.ROLLUP_WATCH;
import goosemod from './building/rollup-plugin-gm/index';
export default {
input: './src/index.js',
output: {
file: './dist/index.js',
format: 'iife',
name: 'goosemod',
sourcemap: false,
freeze: false /* do not freeze exports */
export default [
{
input: './src/index.js',
output: {
file: './dist/goosemod.js',
format: 'iife',
name: 'goosemod',
sourcemap: false,
freeze: false /* do not freeze exports */
},
plugins: [
localResolve(),
prod && terser(),
!prod && serve({
contentBase: 'dist',
port: 1234,
headers: {
'Access-Control-Allow-Origin': '*',
}
}),
goosemod()
],
// fix rollup jank
inlineDynamicImports: true
},
plugins: [
localResolve(),
prod && terser(),
!prod && serve({
contentBase: 'dist',
port: 1234,
headers: {
'Access-Control-Allow-Origin': '*',
}
}),
goosemod()
],
// fix rollup jank
inlineDynamicImports: true
};
{
input: './bootstrap/index.js',
output: {
file: './dist/index.js',
format: 'iife',
name: 'goosemod_bootstrap',
sourcemap: false,
freeze: false /* do not freeze exports */
},
plugins: [
localResolve(),
prod && terser()
],
// fix rollup jank
inlineDynamicImports: true
}
];

@ -180,19 +180,6 @@ const badgeUsers = {
],
translator: [ // People who have translated GooseMod to other languages
'506482395269169153', // Ducko
'394579914860396565', // C4Phoenix
'787017887877169173', // Dziurwa
'274213297316691968', // EnderXH
'500656746440949761', // PandaDriver
'326359466171826176', // sanana the skenana
'396360155480064003', // Skree
'169175121037099008', // TechnoJo4
'189079074054995969', // xirreal
'302734867425132545', // hax4dayz
'172866400900218881', // Komodo
'751092600890458203', // Pukima
'266001128318042113', // maikirakiwi
]
};
@ -201,7 +188,7 @@ export const addBadges = () => {
unpatchers.push(
// User badges
goosemodScope.patcher.userBadges.patch('GooseMod Sponsor',
goosemodScope.patcher.userBadges.patch('#badges.sponsor#',
'https://goosemod.com/img/goose_gold.jpg',
// Force check via query because Discord not properly rerendering
@ -214,7 +201,7 @@ export const addBadges = () => {
{ round: true }
),
goosemodScope.patcher.userBadges.patch('GooseMod Translator',
goosemodScope.patcher.userBadges.patch('#badges.translator#',
'https://goosemod.com/img/goose_globe.png',
// Force check via query because Discord not properly rerendering
@ -227,7 +214,7 @@ export const addBadges = () => {
{ round: true }
),
goosemodScope.patcher.userBadges.patch('GooseMod Developer',
goosemodScope.patcher.userBadges.patch('#badges.developer#',
'https://goosemod.com/img/goose_glitch.jpg',
// Force check via query because Discord not properly rerendering
@ -241,7 +228,7 @@ export const addBadges = () => {
),
// Guild badges
goosemod.patcher.guildBadges.patch('GooseMod Official Discord',
goosemod.patcher.guildBadges.patch('#badges.guild#',
'https://goosemod.com/img/logo.jpg',
// Force check via query because Discord not properly rerendering

@ -17,8 +17,8 @@ export default () => {
if (modules.length === 0) return;
const themesItem = goosemod.settings.items.find((x) => x[1] === goosemod.i18n.goosemodStrings.settings.itemNames.themes)[2];
const pluginsItem = goosemod.settings.items.find((x) => x[1] === goosemod.i18n.goosemodStrings.settings.itemNames.plugins)[2];
const themesItem = goosemod.settings.items.find((x) => x[1] === '#terms.store.themes#')[2];
const pluginsItem = goosemod.settings.items.find((x) => x[1] === '#terms.store.plugins#')[2];
const themes = modules.filter((x) => x.tags.includes('theme'));
const plugins = modules.filter((x) => !x.tags.includes('theme'));
@ -69,7 +69,7 @@ export default () => {
tabbar.props.children.push(React.cloneElement(baseOff, {
id: 'GM_MODULES'
}, 'GooseMod Modules'));
}, '#terms.goosemod.modules#'));
return res;
});

@ -1,34 +0,0 @@
// Based on moduleStore/jsCache - make generic cache class in future as part of util?
import { sha512 } from '../util/hash';
let goosemodScope = {};
export const setThisScope = (scope) => {
goosemodScope = scope;
};
export const getCache = () => JSON.parse(goosemod.storage.get('goosemodi18nCache') || '{}');
export const purgeCache = () => goosemod.storage.remove('goosemodi18nCache');
export const updateCache = (lang, hash, goosemodStrings) => {
let cache = getCache();
cache[lang] = { hash, goosemodStrings };
goosemod.storage.set('goosemodi18nCache', JSON.stringify(cache));
};
export const geti18nData = async (lang) => {
const cache = getCache();
if (cache[lang]) { // && moduleInfo.hash === cache[lang].hash) {
return cache[lang].goosemodStrings;
} else {
const goosemodStrings = await goosemodScope.i18n.geti18nData(lang);
const newHash = await sha512(JSON.stringify(goosemodStrings));
updateCache(lang, newHash, goosemodStrings);
return goosemodStrings;
}
};

@ -1,78 +0,0 @@
import * as Cache from './cache';
export const cache = Cache;
let goosemodScope = {};
export let forced = false;
export let goosemodStrings; // goosemod.i18n.strings
export let discordStrings;
export const setThisScope = (scope) => {
Cache.setThisScope(scope);
goosemodScope = scope;
goosemodScope.i18nCheckNewLangInterval = setInterval(checkForNewLang, 1000);
};
const getDiscordLang = () => goosemodScope.webpackModules.findByProps('getLocaleInfo').getLocaleInfo();
let lastLangCode;
export const checkForNewLang = async () => {
if (forced) return; // If forced, ignore Discord lang
const { code } = getDiscordLang();
if (code === lastLangCode) return; // Lang not changed
// goosemodScope.showToast(`New lang detected`);
await updateExports(code);
};
export const updateExports = async (code) => {
lastLangCode = code;
goosemodStrings = await Cache.geti18nData(code);
const module = goosemodScope.webpackModules.findByProps('getLocaleInfo');
const context = module._proxyContext || module._provider._context; // _proxyContext is old, not in Canary since 12th July
discordStrings = {
...context.defaultMessages,
...context.messages
};
};
export const geti18nData = async (lang = (getDiscordLang().code)) => {
let json; // Undefined by default
try {
json = await (await fetch(`https://raw.githubusercontent.com/GooseMod/i18n/main/langs/${lang}.json`)).json();
} catch (e) { // Likely no translation for language so fallback to en-US
lang = `en-US`;
console.log(`Failed to get GooseMod i18n data, falling back to ${lang}`, e);
json = await (await fetch(`https://raw.githubusercontent.com/GooseMod/i18n/main/langs/${lang}.json`)).json();
}
return json;
};
export const forceLang = async (code) => {
if (code === 'Unspecified') {
forced = false;
await checkForNewLang();
return;
}
forced = true;
await updateExports(code);
};

@ -14,7 +14,6 @@ import * as confirmDialog from './ui/modals/confirm';
import * as Changelog from './ui/modals/changelog';
import * as GoosemodChangelog from './ui/goosemodChangelog';
import * as PackModal from './ui/packModal';
import * as OOTB from './ui/ootb';
import { startLoadingScreen, stopLoadingScreen, updateLoadingScreen, setThisScope as setThisScope1 } from './ui/loading';
@ -27,8 +26,6 @@ import * as ModuleSettingsStore from './moduleSettingsStore';
import moduleStoreAPI from './moduleStore';
import * as i18n from './i18n';
import * as CSSCache from './cssCache';
import * as GMBadges from './gmBadges';
@ -47,7 +44,6 @@ const scopeSetterFncs = [
Changelog.setThisScope,
GoosemodChangelog.setThisScope,
PackModal.setThisScope,
Patcher.setThisScope,
Attrs.setThisScope,
@ -55,8 +51,6 @@ const scopeSetterFncs = [
confirmDialog.setThisScope,
i18n.setThisScope,
GMBadges.setThisScope
];
@ -81,14 +75,10 @@ const importsToAssign = {
changelog: Changelog,
goosemodChangelog: GoosemodChangelog,
packModal: PackModal,
patcher: Patcher,
attrs: Attrs,
reactUtils: ReactUtils,
i18n,
cssCache: CSSCache,
gmBadges: GMBadges,
@ -135,9 +125,6 @@ const init = async function () {
this.startLoadingScreen();
this.updateLoadingScreen('Getting i18n data...');
await this.i18n.checkForNewLang();
this.updateLoadingScreen('Initialising internals...');
let toInstallModules = Object.keys(JSON.parse(this.storage.get('goosemodModules')) || {});
@ -181,7 +168,6 @@ const init = async function () {
}
if (toInstallIsDefault) {
// await this.packModal.ask();
toInstallModules = ['Fucklytics', 'Custom CSS']; // Base modules
}
@ -210,7 +196,6 @@ const init = async function () {
this.settingsUninjects.forEach((x) => x());
clearInterval(this.saveInterval);
clearInterval(this.i18nCheckNewLangInterval);
clearInterval(this.hotupdateInterval);
this.storage.keys().filter((x) => x.toLowerCase().startsWith('goosemod')).forEach((x) => this.storage.remove(x));

@ -23,13 +23,7 @@ export default {
jsCache: JSCache,
idCache: IDCache,
getSettingItemName: (moduleInfo) => {
let item = goosemodScope.i18n.goosemodStrings.settings.itemNames.plugins;
if (moduleInfo.tags.includes('theme')) item = goosemodScope.i18n.goosemodStrings.settings.itemNames.themes;
return item;
},
getSettingItemName: (moduleInfo) => moduleInfo.tags.includes('theme') ? '#terms.store.themes#' : '#terms.store.plugins#',
hotupdate: async (shouldHandleLoadingText = false) => { // Update repos, hotreload any updated modules (compare hashes to check if updated)
if (shouldHandleLoadingText) goosemodScope.updateLoadingScreen(`Getting modules from repos...`);
@ -57,7 +51,7 @@ export default {
const pgpUntrusted = goosemodScope.moduleStoreAPI.verifyPgp(repo).trustState === 'untrusted';
if (pgpUntrusted) { // Repo PGP failed to verify and once had PGP success, refuse to update modules for this repo
goosemodScope.showToast(`Failed to verify repo ${repo.meta.name}, refusing to update it's modules`, { timeout: 10000, type: 'error', subtext: 'GooseMod Store (PGP)' });
goosemodScope.showToast(`Failed to verify repo ${repo.meta.name}, refusing to update it's modules`, { timeout: 10000, type: 'error', subtext: '#terms.goosemod.store#' });
repoPgpChecks[m.repo] = false;
continue;
}
@ -71,7 +65,7 @@ export default {
if (shouldHandleLoadingText) goosemodScope.updateLoadingScreen(`Updating modules...\n${m}`);
updatePromises.push(goosemodScope.moduleStoreAPI.importModule(m, goosemodScope.moduleSettingsStore.checkDisabled(m)).then(async () => {
// goosemodScope.showToast(`Updated ${m}`, { timeout: 5000, type: 'success', subtext: 'GooseMod Store' });
// goosemodScope.showToast(`Updated ${m}`, { timeout: 5000, type: 'success', subtext: '#terms.goosemod.store#' });
}));
}
@ -110,7 +104,7 @@ export default {
const pgpUntrusted = await goosemodScope.moduleStoreAPI.verifyPgp(repo).trustState === 'untrusted';
if (pgpUntrusted) {
goosemodScope.showToast(`Failed to verify repo: ${repo.meta.name}, refusing to use new modules`, { timeout: 10000, type: 'error', subtext: 'GooseMod Store (PGP)' });
goosemodScope.showToast(`Failed to verify repo: ${repo.meta.name}, refusing to use new modules`, { timeout: 10000, type: 'error', subtext: '#terms.goosemod.store#' });
newModules = newModules.concat(goosemodScope.moduleStoreAPI.modules.filter((x) => x.repo === repo.url)).sort((a, b) => a.name.localeCompare(b.name)); // Use cached / pre-existing modules
@ -129,7 +123,7 @@ export default {
resp: _resp // Store raw response (PGP caching)
};
} catch (e) {
goosemodScope.showToast(`Failed to get repo: ${repo.url}`, { timeout: 5000, type: 'error', subtext: 'GooseMod Store' }); // Show error toast to user so they know
goosemodScope.showToast(`Failed to get repo: ${repo.url}`, { timeout: 5000, type: 'error', subtext: '#terms.goosemod.store#' }); // Show error toast to user so they know
console.error(e);
}
@ -150,7 +144,7 @@ export default {
const calculatedHash = await sha512(jsCode);
if (calculatedHash !== moduleInfo.hash) {
goosemodScope.showToast(`Cancelled importing of ${moduleName} due to hash mismatch`, { timeout: 2000, type: 'danger', subtext: 'GooseMod Store' });
goosemodScope.showToast(`Cancelled importing of ${moduleName} due to hash mismatch`, { timeout: 2000, type: 'danger', subtext: '#terms.goosemod.store#' });
console.warn('Hash mismatch', calculatedHash, moduleInfo.hash);
return;
@ -174,7 +168,7 @@ export default {
const item = goosemodScope.settings.items.find((x) => x[1] === goosemodScope.moduleStoreAPI.getSettingItemName(moduleInfo))[2].find((x) => x.subtext === moduleInfo.description);
item.buttonType = 'danger';
item.buttonText = goosemodScope.i18n.discordStrings.REMOVE;
item.buttonText = '#terms.remove#';
item.showToggle = true;
} catch (e) {
// goosemodScope.logger.debug('import', 'Failed to change setting during MS importModule (likely during initial imports so okay)');
@ -190,14 +184,14 @@ export default {
const buttonEl = cardEl.querySelector(`.colorBrand-3pXr91`);
buttonEl.className = buttonEl.className.replace('lookFilled-1Gx00P colorBrand-3pXr91', 'lookOutlined-3sRXeN colorRed-1TFJan');
buttonEl.textContent = goosemodScope.i18n.discordStrings.REMOVE;
buttonEl.textContent = '#terms.remove#';
const toggleEl = cardEl.querySelector(`.container-3auIfb`);
toggleEl.classList.remove('hide-toggle');
}
}
} catch (e) {
goosemodScope.showToast(`Failed to import module ${moduleName}`, { timeout: 2000, type: 'error', subtext: 'GooseMod Store' });
goosemodScope.showToast(`Failed to import module ${moduleName}`, { timeout: 2000, type: 'error', subtext: '#terms.goosemod.store#' });
console.error(e);
}
},
@ -208,7 +202,7 @@ export default {
if (item === undefined) return;
item.buttonType = 'brand';
item.buttonText = goosemodScope.i18n.goosemodStrings.moduleStore.card.button.import;
item.buttonText = '#terms.add#';
item.showToggle = false;
// If themes / plugins open
@ -221,7 +215,7 @@ export default {
const buttonEl = cardEl.querySelector(`.colorRed-1TFJan`);
buttonEl.className = buttonEl.className.replace('lookOutlined-3sRXeN colorRed-1TFJan', 'lookFilled-1Gx00P colorBrand-3pXr91');
buttonEl.textContent = goosemodScope.i18n.goosemodStrings.moduleStore.card.button.import;
buttonEl.textContent = '#terms.add#';
const toggleEl = cardEl.querySelector(`.container-3auIfb`);
toggleEl.classList.add('hide-toggle');
@ -263,7 +257,7 @@ export default {
},
updateStoreSetting: async () => {
let allItems = goosemodScope.settings.items.filter((x) => x[1] === goosemodScope.i18n.goosemodStrings.settings.itemNames.plugins || x[1] === goosemodScope.i18n.goosemodStrings.settings.itemNames.themes);
let allItems = goosemodScope.settings.items.filter((x) => x[1] === '#terms.store.plugins#' || x[1] === '#terms.store.themes#');
for (const i of allItems) {
i[2] = i[2].filter((x) => x.type !== 'card');
@ -299,20 +293,16 @@ export default {
subtext: m.description,
subtext2: m.version === '0' || m.version.toLowerCase().includes('auto') ? '' : `v${m.version}`,
buttonText: goosemodScope.modules[m.name] || goosemodScope.disabledModules[m.name] ? goosemodScope.i18n.discordStrings.REMOVE : goosemodScope.i18n.goosemodStrings.moduleStore.card.button.import,
buttonText: goosemodScope.modules[m.name] || goosemodScope.disabledModules[m.name] ? '#terms.remove#' : '#terms.add#',
onclick: async () => {
goosemodScope.settings[`regen${type}`] = true;
if (goosemodScope.modules[m.name] || goosemodScope.disabledModules[m.name]) {
// el.textContent = goosemodScope.i18n.goosemodStrings.moduleStore.card.button.removing;
goosemodScope.settings.removeModuleUI(m.name, itemName);
return;
}
// el.textContent = goosemodScope.i18n.goosemodStrings.moduleStore.card.button.importing;
if (m.dependencies && m.dependencies.length > 0) { // If it's the initial (on import) import that means it has been imported before
const mainWord = m.dependencies.length === 1 ? 'dependency' : 'dependencies';

@ -6,7 +6,7 @@ export const setThisScope = (scope) => {
goosemodScope = scope;
};
export const startLoadingScreen = () => {
export const startLoadingScreen = () => { return;
loadingEl = document.createElement('div');
loadingEl.style.position = 'absolute';
@ -37,7 +37,7 @@ export const startLoadingScreen = () => {
titleEl.style.boxShadow = 'none';
titleEl.style.webkitBoxShadow = 'none';
titleEl.textContent = `Loading GooseMod`;
titleEl.textContent = `#loading.title#`;
const versionEl = document.createElement('div');
@ -64,9 +64,14 @@ export const startLoadingScreen = () => {
};
export const updateLoadingScreen = (tip) => {
if (!loadingEl) return;
descEl.textContent = tip;
};
export const stopLoadingScreen = () => {
if (!loadingEl) return;
loadingEl.remove();
loadingEl = null;
};

@ -196,7 +196,7 @@ export const settings = async () => {
await sleep(20);
document.querySelector(`[aria-controls="gm-${goosemod.i18n.discordStrings.SETTINGS}-tab"]`).click(); // Open GM Settings page
document.querySelector(`[aria-controls="gm-#terms.settings#-tab"]`).click(); // Open GM Settings page
const scroller = document.querySelector(`.sidebarRegionScroller-3MXcoP`); // Scroll to bottom of Settings
scroller.scrollTop = scroller.offsetHeight - 270;

@ -1,209 +0,0 @@
let goosemodScope = {};
export const setThisScope = (scope) => {
goosemodScope = scope;
};
let themes = [
'Dracula Theme',
'Darkest Theme',
'Solarized Dark Theme',
//'Slate'
];
let packs = [
{
text: 'Minimal',
subtext: 'A basic installation with no visual changes; only analytics blocking and fixes',
modules: ['Hardcoded Color Fixer', 'Fucklytics']
},
{
text: 'Recommended',
subtext: 'The recommended starting experience: a few visual improvements and customisation options',
modules: ['Visual Tweaks', 'Username In Author', 'Custom Sounds', 'Better Message Deletion', 'Nickname Panel'],
base: 'Minimal'
},
{
text: 'Complete',
subtext: 'A large amount of the avaliable modules which overhauls the UI and adds extra features',
modules: ['WYSIWYG Messages', 'Twitch Emotes', 'RadialStatus', 'Simple Status Icons', 'User Popout Creation Date', 'Clear Recent Games', 'Game Activity Button', 'Macros', 'Role Colored Messages'],
base: 'Recommended'
}
];
packs = packs.map((x) => {
if (x.base) {
let basePack = packs.find((y) => y.text === x.base);
x.modules = basePack.modules.concat(...x.modules);
}
return x;
});
const selectionModal = (title, options) => {
return new Promise((res) => {
goosemodScope.webpackModules.findByPropsAll('show')[0].show({
title,
body: 'Body'
});
let form = [...document.getElementsByClassName('form-26zE04')].pop();
form.lastChild.remove(); // Remove footer with button
let content = form.firstChild.firstChild;
content.firstChild.style.flex = 'unset'; // Stop title taking up all of contents
content.lastChild.remove(); // Remove body
let container = form.parentElement;
container.style.maxHeight = 'none';
// container.style.height = '70vh';
let buttonsContainerEl = document.createElement('div');
buttonsContainerEl.style.display = 'flex';
buttonsContainerEl.style.flexDirection = 'column';
buttonsContainerEl.style.justifyContent = 'center';
buttonsContainerEl.style.flexGrow = '1';
for (let p of options) {
let el = document.createElement('div');
el.style.margin = '20px';
el.style.display = 'flex';
el.style.flexDirection = 'column';
let buttonEl = document.createElement('button');
buttonEl.classList.add('primaryButton-2BsGPp', 'button-38aScr', 'lookFilled-1Gx00P', 'colorBrand-3pXr91', 'sizeXlarge-2yFAlZ', 'grow-q77ONN');
buttonEl.onclick = () => {
res(p);
};
if (p.onmouseenter) {
buttonEl.onmouseenter = () => {
p.onmouseenter(container);
};
}
if (p.onmouseleave) {
buttonEl.onmouseleave = () => {
p.onmouseleave(container);
};
}
let contentsEl = document.createElement('div');
contentsEl.classList.add('contents-18-Yxp');
let displayName = p.text; //p.name[0].toUpperCase() + p.name.substring(1);
contentsEl.textContent = displayName;
buttonEl.appendChild(contentsEl);
buttonEl.style.flex = 'unset';
el.appendChild(buttonEl);
let minorEl = document.createElement('div');
minorEl.classList.add('minorContainer-Oi4S_y');
minorEl.style.cursor = 'default';
let minorTextEl = document.createElement('div');
minorTextEl.classList.add('colorStandard-2KCXvj', 'size12-3cLvbJ');
minorTextEl.style.textAlign = 'center';
minorTextEl.style.opacity = '.6';
minorTextEl.textContent = p.subtext; // `${packs[p].length} modules`; //packs[p].map((x) => goosemodScope.moduleStoreAPI.modules.find((y) => y.filename === x)).map((x) => x.name).join(', ');
minorEl.appendChild(minorTextEl);
el.appendChild(minorEl);
buttonsContainerEl.appendChild(el);
}
content.appendChild(buttonsContainerEl);
});
};
const installModules = async (modules) => {
for (let m of modules) {
goosemodScope.updateLoadingScreen(`${goosemodScope.moduleStoreAPI.modules.find((x) => x.name === m).name} - ${modules.indexOf(m) + 1}/${modules.length}`);
await goosemodScope.moduleStoreAPI.importModule(m);
}
};
export const ask = () => {
return new Promise(async (res) => {
goosemodScope.stopLoadingScreen();
let packModules = (await selectionModal('Please pick a pack', packs)).modules;
goosemodScope.startLoadingScreen();
await installModules(packModules);
let themesOptions = themes.map((x) => {
let mod = goosemodScope.moduleStoreAPI.modules.find((y) => y.name === x);
// let imported;
return {
text: mod.name.replace(' Theme', ''),
subtext: mod.description,
actual: x,
onmouseenter: async function(container) {
//if (!x.css) return;
container.style.transition = 'opacity 1s';
container.style.opacity = '0.2';
let backdropEl = document.getElementsByClassName('backdrop-1wrmKB')[0];
backdropEl.style.transition = 'opacity 1s';
backdropEl.style.opacity = '0';
await goosemodScope.moduleStoreAPI.importModule(mod.name);
},
onmouseleave: function(container) {
container.style.opacity = '1';
document.getElementsByClassName('backdrop-1wrmKB')[0].style.opacity = '0.85';
if (!goosemodScope.modules[mod.name]) return;
goosemodScope.settings.removeModuleUI(mod.name);
}
};
});
themesOptions.unshift({
text: 'None',
subtext: 'No additonal theming, stick with default Discord',
actual: ''
});
goosemodScope.stopLoadingScreen();
const theme = (await selectionModal('Please pick a theme', themesOptions)).actual;
let themeEls = document.getElementsByClassName('gm-setup-theme');
for (let e of themeEls) {
e.remove();
}
goosemodScope.startLoadingScreen();
if (theme) {
await installModules([theme]);
}
return res(packModules);
});
};

@ -11,7 +11,7 @@ export default (goosemodScope, gmSettings, Items) => {
case 'changelog': {
if (value) {
const items = [
['item', goosemodScope.i18n.discordStrings.CHANGE_LOG, [''], async () => {
['item', '#terms.changelog#', [''], async () => {
GoosemodChangelog.show();
}, false]
];
@ -49,7 +49,7 @@ export default (goosemodScope, gmSettings, Items) => {
let main = true;
goosemodScope.settings.items = goosemodScope.settings.items.filter((x, i) => {
if (goosemodScope.settings.items[i + 1] && goosemodScope.settings.items[i + 1][1] && goosemodScope.settings.items[i + 1][1] === 'GooseMod Modules') main = false;
if (goosemodScope.settings.items[i + 1] && goosemodScope.settings.items[i + 1][1] && goosemodScope.settings.items[i + 1][1] === '#terms.goosemod.modules#') main = false;
return !(x[0] === 'separator' && main);
});
@ -79,7 +79,7 @@ export default (goosemodScope, gmSettings, Items) => {
let settingDebugShowing = false;
goosemodScope.settings.createItem(goosemodScope.i18n.discordStrings.SETTINGS, ['',
goosemodScope.settings.createItem('#terms.settings#', ['',
{
type: 'header',
text: 'Settings'
@ -508,11 +508,11 @@ Modules: ${Object.keys(goosemodScope.modules).join(', ')}
return (x.github.stars / daysSinceUpdate) - (x.github.stars / 2) + (1 - daysSinceUpdate);
};
[goosemodScope.i18n.goosemodStrings.settings.itemNames.plugins, goosemodScope.i18n.goosemodStrings.settings.itemNames.themes].forEach((x) => goosemodScope.settings.createItem(x, ['',
['#terms.store.plugins#', '#terms.store.themes#'].forEach((x, i) => goosemodScope.settings.createItem(x, ['',
{
type: 'search',
placeholder: `${goosemodScope.i18n.discordStrings.SEARCH} ${x}`,
placeholder: i === 0 ? '#store.options.search.placeholder.plugins#' : '#store.options.search.placeholder.themes#',
onchange: (query) => {
searchQuery = query;
@ -642,14 +642,14 @@ Modules: ${Object.keys(goosemodScope.modules).join(', ')}
if (gmSettings.get().changelog) {
if (gmSettings.get().separators) goosemodScope.settings.createSeparator();
goosemodScope.settings.createItem(goosemodScope.i18n.discordStrings.CHANGE_LOG, [""], async () => {
goosemodScope.settings.createItem('#terms.changelog#', [""], async () => {
GoosemodChangelog.show();
});
}
goosemodScope.settings.createSeparator();
goosemodScope.settings.createHeading(goosemodScope.i18n.goosemodStrings.settings.itemNames.goosemodModules);
goosemodScope.settings.createHeading('#terms.goosemod.modules#');
goosemodScope.settings.items = goosemodScope.settings.items.concat(oldItems);
};

@ -17,17 +17,17 @@ export default (goosemodScope, hasStoreInHome) => {
goosemodScope.settingsUninjects.push(goosemodScope.patcher.contextMenu.patch('user-settings-cog', {
label: 'GooseMod',
sub: [
basicSettingItem(goosemodScope.i18n.discordStrings.SETTINGS),
!hasStoreInHome ? basicSettingItem(goosemodScope.i18n.goosemodStrings.settings.itemNames.plugins) : undefined,
!hasStoreInHome ? basicSettingItem(goosemodScope.i18n.goosemodStrings.settings.itemNames.themes) : undefined,
basicSettingItem(goosemodScope.i18n.discordStrings.CHANGE_LOG)
basicSettingItem('#terms.settings#'),
!hasStoreInHome ? basicSettingItem('#terms.store.plugins#') : undefined,
!hasStoreInHome ? basicSettingItem('#terms.store.themes#') : undefined,
basicSettingItem('#terms.changelog#')
].filter((x) => x)
}));
goosemodScope.settingsUninjects.push(goosemodScope.patcher.contextMenu.patch('user-settings-cog', {
label: goosemodScope.i18n.goosemodStrings.settings.itemNames.goosemodModules,
label: '#terms.goosemod.modules#',
sub: () => {
const moduleItems = goosemodScope.settings.items.slice(goosemodScope.settings.items.indexOf(goosemodScope.settings.items.find((x) => x[1] === goosemodScope.i18n.goosemodStrings.settings.itemNames.goosemodModules)) + 1);
const moduleItems = goosemodScope.settings.items.slice(goosemodScope.settings.items.indexOf(goosemodScope.settings.items.find((x) => x[1] === '#terms.goosemod.modules#')) + 1);
return moduleItems.map((x) => basicSettingItem(x[1]));
}

@ -51,18 +51,18 @@ return class Header extends React.PureComponent {
className: IconClasses.icon
}),
React.createElement(HeaderBarContainer.Title, {}, goosemod.i18n.goosemodStrings.settings.itemNames[this.props.title] || (this.props.title[0].toUpperCase() + this.props.title.substring(1))),
React.createElement(HeaderBarContainer.Title, {}, this.props.title),
tabsSelected[this.props.title] ? React.createElement(HeaderBarContainer.Divider) : null,
tabsSelected[this.props.id] ? React.createElement(HeaderBarContainer.Divider) : null,
tabsSelected[this.props.title] ? React.createElement(TabBar, {
selectedItem: tabsSelected[this.props.title],
tabsSelected[this.props.id] ? React.createElement(TabBar, {
selectedItem: tabsSelected[this.props.id],
type: TabBarClasses1.topPill,
className: TabBarClasses2.tabBar,
onItemSelect: (x) => {
tabsSelected[this.props.title] = x;
tabsSelected[this.props.id] = x;
this.forceUpdate();
setTimeout(goosemod.settings.updateModuleStoreUI, 10);
@ -83,7 +83,7 @@ return class Header extends React.PureComponent {
) : null,
this.props.title !== 'snippets' ? React.createElement('div', {
this.props.id !== 'snippets' ? React.createElement('div', {
className: IconClasses.toolbar,
style: {
@ -94,7 +94,7 @@ return class Header extends React.PureComponent {
React.createElement(HeaderBarContainer.Icon, {
icon: () => UpdateIcon,
tooltip: goosemod.i18n.discordStrings.STAGE_DISCOVERY_REFRESH_ICON_LABEL,
tooltip: '#terms.refresh#',
onClick: async () => {
const svgEl = document.querySelector(`.${IconClasses.toolbar} > [role="button"] > svg`);
@ -108,7 +108,7 @@ return class Header extends React.PureComponent {
React.createElement(HeaderBarContainer.Icon, {
icon: () => ReposIcon,
tooltip: goosemod.i18n.goosemodStrings.moduleStore.repos.repos,
tooltip: '#terms.store.repos#',
onClick: openReposModal
})

@ -40,9 +40,10 @@ export default async (goosemodScope) => {
const LoadingPopout = goosemodScope.webpackModules.findByDisplayName('LoadingPopout');
const makeHeader = (icon, title) => React.createElement(Header, {
const makeHeader = (icon, title, id) => React.createElement(Header, {
icon,
title
title,
id
});
const makeContent = (isLibrary, content) => React.createElement('div', {
@ -58,13 +59,13 @@ export default async (goosemodScope) => {
}
}, content);
const makePage = (icon, title, content) => React.createElement('div', {
const makePage = (icon, title, id, content) => React.createElement('div', {
style: {
height: '100%',
overflow: 'hidden'
}
},
makeHeader(icon, title),
makeHeader(icon, title, id),
makeContent(false, content)
);
@ -81,9 +82,9 @@ export default async (goosemodScope) => {
let expanded = goosemod.storage.get('goosemodHomeExpanded') || true;
let settings = {
plugins: goosemodScope.settings.items.find((x) => x[1] === goosemodScope.i18n.goosemodStrings.settings.itemNames.plugins),
themes: goosemodScope.settings.items.find((x) => x[1] === goosemodScope.i18n.goosemodStrings.settings.itemNames.themes),
snippets: goosemodScope.settings.items.find((x) => x[1] === 'Snippets')
plugins: goosemodScope.settings.items.find((x) => x[1] === '#terms.store.plugins#'),
themes: goosemodScope.settings.items.find((x) => x[1] === '#terms.store.themes#'),
snippets: goosemodScope.settings.items.find((x) => x[1] === '#terms.store.snippets#')
};
let contents = {
@ -92,7 +93,7 @@ export default async (goosemodScope) => {
snippets: goosemodScope.settings._createItem(settings.snippets[1], settings.snippets[2], false)
};
const handleItemClick = (type) => {
const handleItemClick = (title, type) => {
const parentEl = [...document.querySelector(`.content-98HsJk`).children].find((x, i) => i !== 0 && !x.classList.contains('erd_scroll_detection_container'));
for (const x of document.querySelector(`.scroller-1JbKMe`).children[0].children) {
@ -130,7 +131,7 @@ export default async (goosemodScope) => {
if (parentEl.children.length === 1) {
ReactDOM.render(makePage(homeIcons[type], type, contents[type]), parentEl.children[0]);
ReactDOM.render(makePage(homeIcons[type], title, type, contents[type]), parentEl.children[0]);
}
if (parentEl.children.length === 2 || parentEl.children.length === 3) {
@ -141,7 +142,7 @@ export default async (goosemodScope) => {
if (isLibrary) indexOffset = 0;
parentEl.children[indexOffset + 0].className = '';
ReactDOM.render(makeHeader(homeIcons[type], type), parentEl.children[indexOffset + 0]);
ReactDOM.render(makeHeader(homeIcons[type], title, type), parentEl.children[indexOffset + 0]);
if (indexOffset !== 0 && parentEl.children[indexOffset + 1].children[1]) {
parentEl.children[indexOffset + 1].children[1].style.display = 'none';
@ -214,45 +215,45 @@ export default async (goosemodScope) => {
() => React.createElement(LinkButton, {
style: {
display: expanded || document.querySelector('.title-29uC1r')?.textContent === goosemodScope.i18n.goosemodStrings.settings.itemNames.themes ? 'block' : 'none'
display: expanded || document.querySelector('.title-29uC1r')?.textContent === '#terms.store.themes#' ? 'block' : 'none'
},
icon: () => homeIcons.themes,
onClick: () => handleItemClick('themes'),
onClick: () => handleItemClick('#terms.store.themes#', 'themes'),
id: 'gm-home-themes',
text: goosemodScope.i18n.goosemodStrings.settings.itemNames.themes,
text: '#terms.store.themes#',
selected: false
}),
() => React.createElement(LinkButton, {
style: {
display: expanded || document.querySelector('.title-29uC1r')?.textContent === goosemodScope.i18n.goosemodStrings.settings.itemNames.plugins ? 'block' : 'none'
display: expanded || document.querySelector('.title-29uC1r')?.textContent === '#terms.store.plugins#' ? 'block' : 'none'
},
icon: () => homeIcons.plugins,
onClick: () => handleItemClick('plugins'),
onClick: () => handleItemClick('#terms.store.plugins#', 'plugins'),
id: 'gm-home-plugins',
text: goosemodScope.i18n.goosemodStrings.settings.itemNames.plugins,
text: '#terms.store.plugins#',
selected: false
}),
snippetsEnabled ? () => React.createElement(LinkButton, {
style: {
display: expanded || document.querySelector('.title-29uC1r')?.textContent === 'Snippets' ? 'block' : 'none'
display: expanded || document.querySelector('.title-29uC1r')?.textContent === '#terms.store.snippets#' ? 'block' : 'none'
},
icon: () => homeIcons.snippets,
onClick: () => handleItemClick('snippets'),
onClick: () => handleItemClick('#terms.store.snippets#', 'snippets'),
id: 'gm-home-snippets',
text: 'Snippets',
text: '#terms.store.snippets#',
selected: false
}) : null
@ -324,7 +325,7 @@ export default async (goosemodScope) => {
subtext: x.content.replace(/```css(.*)```/gs, ''), // Only context / text without code
buttonText: snippetsLoaded[x.id] ? goosemodScope.i18n.discordStrings.REMOVE : goosemodScope.i18n.discordStrings.ADD,
buttonText: snippetsLoaded[x.id] ? '#terms.remove#' : '#terms.add#',
buttonType: snippetsLoaded[x.id] ? 'danger' : 'brand',
onclick: () => {
@ -340,9 +341,9 @@ export default async (goosemodScope) => {
delete snippetsLoaded[x.id];
buttonEl.className = buttonEl.className.replace('lookOutlined-3sRXeN colorRed-1TFJan', 'lookFilled-1Gx00P colorBrand-3pXr91');
buttonEl.textContent = goosemodScope.i18n.discordStrings.ADD;
buttonEl.textContent = '#terms.add#';
cardSet.buttonText = goosemodScope.i18n.discordStrings.ADD;
cardSet.buttonText = '#terms.add#';
cardSet.buttonType = 'brand';
} else { // Add
snippetsLoaded[x.id] = document.createElement('style');
@ -352,9 +353,9 @@ export default async (goosemodScope) => {
document.body.appendChild(snippetsLoaded[x.id]);
buttonEl.className = buttonEl.className.replace('lookFilled-1Gx00P colorBrand-3pXr91', 'lookOutlined-3sRXeN colorRed-1TFJan');
buttonEl.textContent = goosemodScope.i18n.discordStrings.REMOVE;
buttonEl.textContent = '#terms.remove#';
cardSet.buttonText = goosemodScope.i18n.discordStrings.REMOVE;
cardSet.buttonText = '#terms.remove#';
cardSet.buttonType = 'danger';
}

@ -32,7 +32,7 @@ export default async () => {
size: ButtonClasses['sizeSmall'],
onClick: this.props.buttonOnClick
}, goosemod.i18n.discordStrings.REMOVE),
}, '#terms.remove#'),
React.createElement(SwitchItem, {
...this.props
@ -94,7 +94,7 @@ export default async () => {
switch (repo.pgp.trustState) {
case 'trusted':
tooltip = 'PGP Verified';
tooltip = '#store.pgp.verified#';
icon = React.createElement(Verified, {
className: "icon-1ihkOt"
@ -103,7 +103,7 @@ export default async () => {
break;
case 'untrusted':
tooltip = 'PGP Untrusted';
tooltip = '#store.pgp.untrusted#';
icon = React.createElement(Alert, {
className: "icon-1ihkOt"
@ -112,7 +112,7 @@ export default async () => {
break;
case 'unknown':
tooltip = 'No PGP';
tooltip = '#store.pgp.unknown#';
icon = React.createElement(Alert, {
className: "icon-1ihkOt"
@ -192,7 +192,7 @@ export default async () => {
React.createElement(Header, {
tag: 'h2',
size: Header.Sizes.SIZE_20
}, goosemod.i18n.goosemodStrings.moduleStore.repos.repos),
}, '#terms.store.repos#'),
React.createElement(Text, {
size: Text.Sizes.SIZE_12,
@ -249,12 +249,12 @@ export default async () => {
}
if (resp.meta?.name === undefined) {
goosemod.showToast(`Invalid Repo`, { type: 'error', timeout: 5000, subtext: 'GooseMod Store' });
goosemod.showToast(`Invalid Repo`, { type: 'error', timeout: 5000, subtext: '#terms.goosemod.store#' });
return;
}
const confirmExternal = confirm(`External repos pose security risks as they are not controlled by GooseMod developers. We are not responsible for any dangers because of external repos added by users.\n\nIf you do not trust the owner of this repo do not use it as it could compromise your Discord install.\n\nPlease confirm adding this repo by pressing OK.`);
const confirmExternal = confirm('#modals.external_repo_security.main#');
if (!confirmExternal) {
goosemod.showToast(`Cancelled Adding Repo`, { type: 'danger', timeout: 5000, subtext: 'Refused Security Prompt' });
@ -275,7 +275,7 @@ export default async () => {
return;
}
if (pgpResult.trustState !== 'trusted' && !confirm(`This repo is not known or trusted (no PGP verification), please be extra careful. Make sure you trust the owner(s) of this repo completely.\n\nTo solve this issue ask the repo maintainer to add PGP support.\n\nPlease reconfirm adding this repo by pressing OK.`)) { // Warn again with no PGP
if (pgpResult.trustState !== 'trusted' && !confirm(`#modals.external_repo_security.bad_pgp#`)) { // Warn again with no PGP
goosemod.showToast(`Cancelled Adding Repo`, { type: 'danger', timeout: 5000, subtext: 'Refused Security Prompt' });
return;
@ -286,7 +286,7 @@ export default async () => {
restartModal();
}
}, goosemod.i18n.discordStrings.ADD)
}, '#terms.add#')
)
)
);

@ -134,7 +134,7 @@ export const _createItem = (name, content, container = true) => {
});
return container ? React.createElement(FormSection, {
className: name === goosemodScope.i18n.goosemodStrings.settings.itemNames.plugins || name === goosemodScope.i18n.goosemodStrings.settings.itemNames.themes ? 'gm-store-settings' : ''
className: name === '#terms.store.plugins#' || name === '#terms.store.themes#' ? 'gm-store-settings' : ''
},
React.createElement(FormTitle, { tag: 'h1' }, name),

@ -13,7 +13,7 @@ export default (goosemodScope, gmSettings) => {
sections.splice(
sections.indexOf(logout), 0,
...goosemodScope.settings.items.filter((x) => (gmSettings.get().home ? x[1] !== goosemodScope.i18n.goosemodStrings.settings.itemNames.plugins && x[1] !== goosemodScope.i18n.goosemodStrings.settings.itemNames.themes && x[1] !== 'Snippets': true) && (!gmSettings.get().snippets ? x[1] !== 'Snippets' : true)).map((i) => {
...goosemodScope.settings.items.filter((x) => (gmSettings.get().home ? x[1] !== '#terms.store.plugins#' && x[1] !== '#terms.store.themes#' && x[1] !== '#terms.store.snippets#': true) && (!gmSettings.get().snippets ? x[1] !== '#terms.store.snippets#' : true)).map((i) => {
switch (i[0]) {
case 'item':
let obj = {
@ -32,7 +32,7 @@ export default (goosemodScope, gmSettings) => {
const settingsLayerEl = document.querySelector('div[aria-label="USER_SETTINGS"]');
const settingsSidebarEl = settingsLayerEl.querySelector('nav > div');
if (i[1] === goosemodScope.i18n.goosemodStrings.settings.itemNames.plugins || i[1] === goosemodScope.i18n.goosemodStrings.settings.itemNames.themes || i[1] === 'Snippets') { // Settings expansion for Store panel
if (i[1] === '#terms.store.plugins#' || i[1] === '#terms.store.themes#' || i[1] === '#terms.store.snippets#') { // Settings expansion for Store panel
setTimeout(() => {
document.querySelector('.sidebarRegion-VFTUkN').style.maxWidth = '218px';
document.querySelector('.contentColumnDefault-1VQkGM').style.maxWidth = 'calc(100vw - 218px - 60px - 20px)';
@ -40,7 +40,7 @@ export default (goosemodScope, gmSettings) => {
settingsSidebarEl.addEventListener('click', (e) => {
if (e.clientX === 0 // <el>.click() - not an actual user click - as it has no mouse position coords (0, 0)
|| e.target.textContent === goosemodScope.i18n.goosemodStrings.settings.itemNames.plugins || e.target.textContent === goosemodScope.i18n.goosemodStrings.settings.itemNames.themes || e.target.textContent === 'Snippets') return; // Clicking on Store when already in it should not break resizing
|| e.target.textContent === '#terms.store.plugins#' || e.target.textContent === '#terms.store.themes#' || e.target.textContent === '#terms.store.snippets#') return; // Clicking on Store when already in it should not break resizing
document.querySelector('.sidebarRegion-VFTUkN').style.maxWidth = '50%';
document.querySelector('.contentColumnDefault-1VQkGM').style.maxWidth = '740px';

Loading…
Cancel
Save