Skip to content

Commit

Permalink
Add Config page option for registerProtcol preference
Browse files Browse the repository at this point in the history
  • Loading branch information
oblivioncth committed Oct 24, 2023
1 parent acb87d1 commit 36535a5
Show file tree
Hide file tree
Showing 24 changed files with 66 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lang/cs-CZ.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Spusit úlohy údržby pro zvýšení výkonu databáze a snížení její velikosti",
"showDeveloperTab": "Zobrazit záložku pro vývojáře",
"showDeveloperTabDesc": "Zobrazí záložku \"Vývojář\". Toto je obvykle užitečné pouze pro vývojáře a kurátory.",
"registerProtocol": "Zaregistrujte se jako obsluha protokolu",
"registerProtocolDesc": "Registruje spouštěč, aby odpovídal na požadavky protokolu 'flashpoint://'.",
"server": "Server",
"serverDesc": "Který server má být využíván při hraní her.",
"curateServer": "Kurátovat server",
Expand Down
2 changes: 2 additions & 0 deletions lang/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Wartungsarbeiten durchführen, um die Leistung der Datenbank zu verbessern und ihre Größe zu verringern",
"showDeveloperTab": "Entwicklerkarte zeigen",
"showDeveloperTabDesc": "Zeige die Karte \"Entwickler\". Diese ist wahrscheinlich nur für Entwickler und Kuratoren nützlich.",
"registerProtocol": "Als Protokollhandler registrieren",
"registerProtocolDesc": "Registriert den Launcher, um auf „flashpoint://“-Protokollanfragen zu antworten.",
"server": "Server",
"serverDesc": "Welcher Server beim Spielen ausgeführt werden soll.",
"curateServer": "Server Kuratieren",
Expand Down
2 changes: 2 additions & 0 deletions lang/el-GR.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Run maintenance tasks to increase database performance and reduce size",
"showDeveloperTab": "Προβολή Καρτέλας Προγραμματιστών",
"showDeveloperTabDesc": "Προβολή καρτέλας «Για Προγραμματιστές». Πιθανόν να είναι πιο χρήσιμο αυτό για προγραμματιστές και επιμελητές.",
"registerProtocol": "Εγγραφή ως Χειριστής Πρωτοκόλλου",
"registerProtocolDesc": "Καταχωρεί το πρόγραμμα εκκίνησης για να ανταποκρίνεται σε αιτήματα πρωτοκόλλου «flashpoint://».",
"server": "Διακομιστής",
"serverDesc": "Which Server to run when playing games.",
"curateServer": "Curate Server",
Expand Down
2 changes: 2 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Run maintenance tasks to increase database performance and reduce size",
"showDeveloperTab": "Show Developer Tab",
"showDeveloperTabDesc": "Show the 'Developer' tab. This is most likely only useful for developers and curators.",
"registerProtocol": "Register As Protocol Handler",
"registerProtocolDesc": "Registers the launcher to respond to 'flashpoint://' protocol requests.",
"server": "Server",
"serverDesc": "Which Server to run when playing games.",
"curateServer": "Curate Server",
Expand Down
2 changes: 2 additions & 0 deletions lang/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Run maintenance tasks to increase database performance and reduce size",
"showDeveloperTab": "Mostrar la pestaña Desarrollador",
"showDeveloperTabDesc": "Mostrar la pestaña 'Desarrollador'. Esta es muy probable que sólo sea útil para desarrolladores y curadores.",
"registerProtocol": "Registrarse como controlador de protocolo",
"registerProtocolDesc": "Registra el iniciador para responder a las solicitudes del protocolo 'flashpoint://'.",
"server": "Servidor",
"serverDesc": "Which Server to run when playing games.",
"curateServer": "Curate Server",
Expand Down
2 changes: 2 additions & 0 deletions lang/et-EE.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Run maintenance tasks to increase database performance and reduce size",
"showDeveloperTab": "Näita Arendaja Akent",
"showDeveloperTabDesc": "Näita 'Arendaja' akent. See on enamasti kasulik vaid arendajatele ja kuraatoritele.",
"registerProtocol": "Registreeru protokollihalduriks",
"registerProtocolDesc": "Registreerib käivitusprogrammi, et vastata protokolli 'flashpoint://' päringutele.",
"server": "Server",
"serverDesc": "Which Server to run when playing games.",
"curateServer": "Curate Server",
Expand Down
2 changes: 2 additions & 0 deletions lang/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Exécute des tâches de maintenance pour augmenter la performance de la base de données et en réduire la taille",
"showDeveloperTab": "Afficher l'onglet Développeur",
"showDeveloperTabDesc": "Affiche l'onglet 'Développeur'. Ceci n'est probablement utile que pour les développeurs et les conservateurs.",
"registerProtocol": "S'inscrire en tant que gestionnaire de protocole",
"registerProtocolDesc": "Enregistre le lanceur pour répondre aux requêtes du protocole « flashpoint:// ».",
"server": "Serveur",
"serverDesc": "Quel serveur à utiliser pour lancer des jeux.",
"curateServer": "Serveur de conservation",
Expand Down
2 changes: 2 additions & 0 deletions lang/hu-HU.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Karbantartási feladatok futtatása az adatbázis teljesítményének növeléséhez és az adatbázis méretének csökkentéséhez",
"showDeveloperTab": "Fejlesztői lap megjelenítése",
"showDeveloperTabDesc": "Ez lehet csak fejlesztők és kurátorok számára hasznos.",
"registerProtocol": "Regisztráljon protokollkezelőként",
"registerProtocolDesc": "Regisztrálja az indítót, hogy válaszoljon a „flashpoint://” protokollkérésekre.",
"server": "Szerver",
"serverDesc": "Melyik szerver legyen futtatva kuráció futtatásakor.",
"curateServer": "Szerver kurációja",
Expand Down
2 changes: 2 additions & 0 deletions lang/it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Esegui attività di manutenzione per aumentare le prestazioni del database e ridurre le dimensioni",
"showDeveloperTab": "Mostra Scheda Sviluppatore",
"showDeveloperTabDesc": "Mostra la scheda 'Sviluppatore'. Molto probabilmente utile solo per sviluppatori e curatori.",
"registerProtocol": "Registrati come gestore del protocollo",
"registerProtocolDesc": "Registra il programma di avvio per rispondere alle richieste del protocollo 'flashpoint://'.",
"server": "Server",
"serverDesc": "Quale server avviare durante la partita.",
"curateServer": "Server Curato",
Expand Down
2 changes: 2 additions & 0 deletions lang/mk-MK.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Run maintenance tasks to increase database performance and reduce size",
"showDeveloperTab": "Покажи карта за програмери",
"showDeveloperTabDesc": "Покажи ја картичката за „Програмер“. Ова е најверојатно корисно само за програмери и куратори.",
"registerProtocol": "Регистрирајте се како ракувач со протоколи",
"registerProtocolDesc": "Го регистрира фрлачот за да одговори на барањата за протокол „flashpoint://“.",
"server": "Сервер",
"serverDesc": "Which Server to run when playing games.",
"curateServer": "Curate Server",
Expand Down
2 changes: 2 additions & 0 deletions lang/nl-NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Run maintenance tasks to increase database performance and reduce size",
"showDeveloperTab": "Toon Ontwikkelaar Tabblad",
"showDeveloperTabDesc": "Toon de 'Ontwikkelaars' tab. Dit is waarschijnlijk alleen handig voor ontwikkelaars en curatoren.",
"registerProtocol": "Registreer als protocolbehandelaar",
"registerProtocolDesc": "Registreert het opstartprogramma om te reageren op 'flashpoint://'-protocolverzoeken.",
"server": "Server",
"serverDesc": "Which Server to run when playing games.",
"curateServer": "Curate Server",
Expand Down
2 changes: 2 additions & 0 deletions lang/pl-PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Run maintenance tasks to increase database performance and reduce size",
"showDeveloperTab": "Pokaż zakładkę dla deweloperów",
"showDeveloperTabDesc": "Pokaż zakładkę 'Dla deweloperów'. Najpewniej przyda się tylko deweloperom i kuratorom.",
"registerProtocol": "Zarejestruj się jako osoba obsługująca protokół",
"registerProtocolDesc": "Rejestruje program uruchamiający, aby odpowiadał na żądania protokołu „flashpoint://”.",
"server": "Serwer",
"serverDesc": "Which Server to run when playing games.",
"curateServer": "Curate Server",
Expand Down
2 changes: 2 additions & 0 deletions lang/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Run maintenance tasks to increase database performance and reduce size",
"showDeveloperTab": "Mostrar Aba de Desenvolvedor",
"showDeveloperTabDesc": "Mostra a aba de 'Desenvolvedor'. Isto provavelmente só é útil para desenvolvedores e curadores.",
"registerProtocol": "Registre-se como manipulador de protocolo",
"registerProtocolDesc": "Registra o inicializador para responder às solicitações do protocolo 'flashpoint://'.",
"server": "Servidor",
"serverDesc": "Which Server to run when playing games.",
"curateServer": "Curate Server",
Expand Down
2 changes: 2 additions & 0 deletions lang/ro-RO.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Run maintenance tasks to increase database performance and reduce size",
"showDeveloperTab": "Arătați butonul „Dezvoltator“",
"showDeveloperTabDesc": "Se va arăta butonul „Dezvoltator“. Cel mai folositor va fi pentru dezvoltatori și reparatori.",
"registerProtocol": "Înregistrați-vă ca operator de protocol",
"registerProtocolDesc": "Înregistrează lansatorul pentru a răspunde solicitărilor de protocol „flashpoint://”.",
"server": "Server",
"serverDesc": "Which Server to run when playing games.",
"curateServer": "Curate Server",
Expand Down
2 changes: 2 additions & 0 deletions lang/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Run maintenance tasks to increase database performance and reduce size",
"showDeveloperTab": "Показать вкладку разработчика",
"showDeveloperTabDesc": "Показывает вкладку \"Разработчикам\". Она полезна в большинстве случаев только для разработчиков и кураторов.",
"registerProtocol": "Зарегистрироваться как обработчик протокола",
"registerProtocolDesc": "Регистрирует средство запуска для ответа на запросы протокола «flashpoint://».",
"server": "Сервер",
"serverDesc": "Which Server to run when playing games.",
"curateServer": "Curate Server",
Expand Down
2 changes: 2 additions & 0 deletions lang/sv-SE.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Run maintenance tasks to increase database performance and reduce size",
"showDeveloperTab": "Visa flik för utvecklare",
"showDeveloperTabDesc": "Visa fliken \"Utvecklare\". Det är med största sannolikhet bara utvecklare och kuratorer som har användning för detta.",
"registerProtocol": "Registrera dig som protokollhanterare",
"registerProtocolDesc": "Registrerar startprogrammet för att svara på 'flashpoint://'-protokollförfrågningar.",
"server": "Server",
"serverDesc": "Which Server to run when playing games.",
"curateServer": "Curate Server",
Expand Down
2 changes: 2 additions & 0 deletions lang/tr-TR.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Run maintenance tasks to increase database performance and reduce size",
"showDeveloperTab": "Geliştirici Panelini Göster",
"showDeveloperTabDesc": "'Geliştirici' panelini göster. Bu daha çok geliştiriciler ve küratörler için kullanışlıdır.",
"registerProtocol": "Protokol İşleyicisi Olarak Kaydolun",
"registerProtocolDesc": "Başlatıcıyı 'parlama noktası://' protokol isteklerine yanıt verecek şekilde kaydeder.",
"server": "Sunucu",
"serverDesc": "Oyun oynarken çalıştırılacak Sunucu.",
"curateServer": "Curate Server",
Expand Down
2 changes: 2 additions & 0 deletions lang/vi-VN.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Run maintenance tasks to increase database performance and reduce size",
"showDeveloperTab": "Hiện trang Nhà phát triển",
"showDeveloperTabDesc": "Hiện trang 'Nhà phát triển'. Hữu dụng nhất cho lập trình viên và người đóng góp.",
"registerProtocol": "Đăng ký làm người xử lý giao thức",
"registerProtocolDesc": "Đăng ký trình khởi chạy để đáp ứng các yêu cầu giao thức 'flashpoint://'.",
"server": "Máy chủ",
"serverDesc": "Which Server to run when playing games.",
"curateServer": "Curate Server",
Expand Down
2 changes: 2 additions & 0 deletions lang/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
"advancedHeader": "高级",
"optimizeDatabase": "优化数据库",
"optimizeDatabaseDesc": "运行维护任务以增强数据库性能并减小文件大小",
"registerProtocol": "注册为协议处理程序",
"registerProtocolDesc": "注册启动器以响应“flashpoint://”协议请求。",
"showDeveloperTab": "显示开发者标签页",
"showDeveloperTabDesc": "显示 '开发者' 标签页,通常只对开发者与展品管理员有用。",
"server": "服务器",
Expand Down
2 changes: 2 additions & 0 deletions lang/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"optimizeDatabaseDesc": "Run maintenance tasks to increase database performance and reduce size",
"showDeveloperTab": "顯示開發者頁籤",
"showDeveloperTabDesc": "顯示「開發者」頁籤,提供開發者與上傳人員一些實用的工具",
"registerProtocol": "註冊為協議處理程序",
"registerProtocolDesc": "註冊啟動器以回應“flashpoint://”協定請求。",
"server": "伺服器",
"serverDesc": "Which Server to run when playing games.",
"curateServer": "Curate Server",
Expand Down
3 changes: 3 additions & 0 deletions src/main/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ export function main(init: Init): void {
ipcMain.handle(CustomIPC.SHOW_SAVE_DIALOG, async (event, opts) => {
return dialog.showSaveDialog(opts);
});
ipcMain.handle(CustomIPC.REGISTER_PROTOCOL, async (event, register) => {
return setProtocolRegistrationState(register);
});

// Add Socket event listener(s)
state.socket.register(BackOut.QUIT, () => {
Expand Down
19 changes: 19 additions & 0 deletions src/renderer/components/pages/ConfigPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { WithPreferencesProps } from '@renderer/containers/withPreferences';
import { WithTagCategoriesProps } from '@renderer/containers/withTagCategories';
import { BackIn } from '@shared/back/types';
import { AppExtConfigData } from '@shared/config/interfaces';
import { CustomIPC } from '@shared/interfaces';
import { ipcRenderer } from 'electron';
import { ExtConfigurationProp, ExtensionContribution, IExtensionDescription, ILogoSet } from '@shared/extensions/interfaces';
import { autoCode, LangContainer, LangFile } from '@shared/lang';
import { memoizeOne } from '@shared/memoize';
Expand Down Expand Up @@ -331,6 +333,12 @@ export class ConfigPage extends React.Component<ConfigPageProps, ConfigPageState
description={strings.showDeveloperTabDesc}
checked={this.props.preferencesData.showDeveloperTab}
onToggle={this.onShowDeveloperTab} />
{/* Register As Protocol Handler */}
<ConfigBoxCheckbox
title={strings.registerProtocol}
description={strings.registerProtocolDesc}
checked={this.props.preferencesData.registerProtocol}
onToggle={this.onRegisterProtocol} />
{/* Server */}
<ConfigBoxSelect
title={strings.server}
Expand Down Expand Up @@ -978,6 +986,17 @@ export class ConfigPage extends React.Component<ConfigPageProps, ConfigPageState
updatePreferencesData({ showDeveloperTab: isChecked });
};

onRegisterProtocol = (isChecked: boolean): void => {
updatePreferencesData({ registerProtocol: isChecked });
ipcRenderer.invoke(CustomIPC.REGISTER_PROTOCOL, isChecked)
.then((success) => {
if (!success) {
const regVerb = isChecked ? 'add' : 'remove';
alert('Failed to ' + regVerb + ' protocol registration');
}
});
};

onCurrentThemeChange = (value: string): void => {
const selectedTheme = this.props.themeList.find(t => t.id === value);
if (selectedTheme) {
Expand Down
3 changes: 2 additions & 1 deletion src/shared/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ export enum WindowIPC {
export enum CustomIPC {
SHOW_MESSAGE_BOX = 'show-message-box',
SHOW_SAVE_DIALOG = 'show-save-dialog',
SHOW_OPEN_DIALOG = 'show-open-dialog'
SHOW_OPEN_DIALOG = 'show-open-dialog',
REGISTER_PROTOCOL = 'register-protocol'
}

/** IPC channels used to relay game manager events from */
Expand Down
2 changes: 2 additions & 0 deletions src/shared/lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ const langTemplate = {
'optimizeDatabaseDesc',
'showDeveloperTab',
'showDeveloperTabDesc',
'registerProtocol',
'registerProtocolDesc',
'server',
'serverDesc',
'curateServer',
Expand Down

0 comments on commit 36535a5

Please sign in to comment.