Нажмите "New Application", и назовите приложение. Это название будет отображаться в вашем статусе.
7 |
(Опционально) Перейдите во вкладку "Rich Presence" и нажмите кнопку загрузки для загрузки изображений.
8 | Придумайте для них короткое название.
9 |
Закройте вкладку Developer Portal.
10 |
11 |
Шаг 2
12 |
13 |
Вернитесь к основному окну программы.
14 | Придумайте название для файла статуса (оно не должно совпадать с названием приложения).
15 |
Вставьте Client ID. Если вы были на портале разработчика из шага 1, он должен был скопироваться
16 | автоматически.
17 |
Заполните оставшиеся поля по своему желанию.
18 |
19 |
Смотрите скриншот ниже.
20 |
21 |
Нажмите кнопку "Сохранить".
22 |
Нажмите кнопку "Загрузить статус", и смотрите на статус в Discord!
23 |
24 |
Убедитесь, что Discord запущен перед нажатием на кнопку.
25 |
Это должно быть приложение Discord, не web-версия.
26 |
Если игровая активность не отображается...
27 |
28 |
Убедитесь, что ваш статус не невидимый/оффлайн.
29 |
Убедитесь, что отображение игровой активности включено в настройках Discord.
30 |
Убедитесь, что вы нажали на кнопку "Сохранить" до того, как нажали кнопку "Загрузить статус".
31 |
32 |
33 |
34 |
35 |
36 |
Скриншот
37 |
38 |
Кастомные темы
39 |
Если вы заметили, в настройках (иконка шестерëнки снизу справа) последняя опция для тем это "Кастомная". Чтобы
40 | создать кастомную тему:
41 |
42 |
43 |
Вернитесь на главный экран.
44 |
Нажмите кнопку "Показать в папке".
45 |
Отредактируйте и сохраните файл custom.css. Редактирование цветов в 6-значном hex формате. Продвинутое
46 | редактирование требует углублëнного знания CSS.
47 |
Выберите "Кастомная" внизу списка тем.
48 |
49 |
50 |
Решение проблем
51 |
Помогите, пробежался быстро по инструкции и ничего не понял!
52 |
В начале инструкции было предупреждение насчёт этого. Вернитесь к началу и проделайте всë шаг за шагом ВНИМАТЕЛЬНО.
53 |
54 |
Кнопки в статусе не работают!
55 |
Discord не позволяет нажимать на свои кнопки. Однако, все остальные могут это делать. Это лимит самого Discord.
56 |
Статус не отображается!
57 |
Убедитесь, что вы не невидимый/оффлайн. Если статус онлайн/не активен/не беспокоить...
58 |
59 |
Убедитесь, что другая программа не занимает слот игровой активности.
60 |
Перейдите в Настройки > Игровая активность, включите "Отображать в статусе игру, в которую вы сейчас играете".
61 |
62 |
ИЗВЕСТЕН БАГ на macOS 11 из-за которого вы не можете видеть свой статус. При этом другие его могут видеть.
63 | Это проблема клиента Discord на macOS 11, не моей программы.
64 |
Если ничего не помогает, просто закройте и снова запустите Discord.
65 |
66 |
Картинки не отображаются!
67 |
Если вы только что их загрузили, дискорду нужна примерно минута для их кэширования.
68 |
69 |
Титры
70 |
Разработчики
71 |
72 |
Создание приложения, разработка: ThatOneCalculator
73 |
Со-разработчик, дизайнер UI: KraXen72
74 |
75 |
Используемые компоненты
76 |
77 |
Множество CSS элементов: Fosscord
78 |
Фреймворк: Electron
79 |
Компилятор: electron-builder
80 |
Запуск статуса: discord-rpc by discord.js
81 |
82 |
Донатеры
83 |
84 |
KingParity
85 |
Dylan Stone
86 |
Lil Fox YT
87 |
88 |
Переводчики
89 |
90 |
Словацкий: KraXen72
91 |
Испанский: Jimmysit0
92 |
Упрощëнный китайский: macpherson
93 |
Панджаби: Toxician
94 |
Греческий: TheTaxPerson
95 |
Польский: Artugr18
96 |
Корейский: justiceserv
97 |
Ирландский: fnionn
98 |
Венгерский: aprobeni
99 |
Немецкий: nonamewastaken
100 |
Французский: Cypooos
101 |
Датский: SAM
102 |
Русский: NightStranger
103 |
Латвия: Laaru
104 |
105 |
Помощники Discord
106 |
107 |
Cyanomous#1001
108 |
Dylanstone#0001
109 |
KingParity#7362
110 |
Lumi/Steve the Catboy#7948
111 |
Toxician#4225
112 |
zeta#0700
113 |
114 |
Лицензия
115 |
Вампус и используемые гифки Вампуса были задизайнены и разработаны Discord inc. Эта программа официально не связана с
116 | Discord inc.
Appuie sur "New Application", et donne lui un nom ! Ce sera le nom affiché de ta Présence.
7 |
(Optionnel) Aller dans l'onglet "Rich Presence", et cliquer sur le bouton d'upload d'image pour téléverser
8 | des images. Donne-leur un court nom cohérant.
9 |
Fermer le Portail pour Dévellopeur
10 |
11 |
Deuxième étape
12 |
13 |
Reviens sur l'application principale.
14 |
Donne un nom de fichier à ta présence (pas nécessairement le même que celui donné à ton application).
15 |
Colle ton ID Client. Si tu es allé sur le Portail pour Dévellopeur, il a été copié automatiquement.
16 |
Remplis les autres champs comme tu veux.
17 |
18 |
Regarde le schéma ci-dessous si tu es confus !
19 |
20 |
Clique sur le bouton "Sauvegarder"
21 |
Clique sur le bouton "Démarrer la Présence", et regarde ta présence prendre vie !
22 |
23 |
Assure-toi que Discord soit bien lancé avant que tu démarre ta présence.
24 |
Cela ne fonctionne que sur l'application.
25 |
Si ta présence ne s'affiche pas...
26 |
27 |
Vérifie que tu n'est pas en mode invisible/déconnecté.
28 |
Vérifie que l'option "Activité de jeu" soit activé sur Discord.
29 |
Vérifie que tu as bien cliquer sur le bouton "Sauvegarder" avant d'avoir cliquer sur le bouton
30 | "Démarrer la Présence".
31 |
32 |
33 |
34 |
35 |
Schéma
36 |
37 |
Thèmes Personnalisé
38 |
Dans les paramètres (l'icone d'engrenage en bas à droite), la dernière option est "Custom". Pour faire un thème
39 | personnalisé:
40 |
41 |
42 |
Retourner sur l'écran principal
43 |
Clique sur le bouton "Montrer le fichier"
44 |
Vous pouvez éditer et modifier le fichier custom.css. Les couleurs sont sauvegardée en hexadécimal à 6
45 | charactères. De l'édition
46 | plus poussé nécéssite des connaissances basique en CSS.
47 |
Selectionner l'option Custom en bas de la liste.
48 |
49 |
50 |
Problèmes occurents
51 |
Aidez-moi, je suis confu et j'ai suivi les instructions `run from source` !
52 |
Il y avait un avertissement à cet endroit pour une raison. Reviens en arrière et lis les instructions d'installation
53 | normale, potat.
54 |
Mes boutons ne marchent pas !
55 |
Discord ne te permet pas de cliquer sur tes propres boutons. Par contre, tout le monde peut. C'est une limitation
56 | avec Discord.
57 |
Je ne peux pas voir ma présence !
58 |
Vérifie que tu n'es pas invisible/déconnecté. Et sinon...
59 |
60 |
Vérifie que il n'y a pas un autre programme qui créé une présence aussi.
61 |
Vas dans Discord > Paramètres > Activité de Jeu > Vérifie que "Affiche le jeu en cours en tant que message de
62 | statut" est activé.
63 |
IL Y A UN BUG CONNU DANS macOS 11, où tu ne peux pas voir ta propre présence. Par contre, les autres personnes
64 | le peuvent.
65 | Ce bug est avec le client Discord sur macOS 11, pas ce programme.
66 |
Si tout rate, ferme et redémarre Discord.
67 |
68 |
Les images ne s'affichent pas !
69 |
Si tu viens de les rajouter, parfois Discord prend un peu de temps avant de les ajouter proprement.
70 |
71 |
Credits
72 |
Dévellopeurs
73 |
74 |
Création de l'application, dévellopement : ThatOneCalculator
Le Wumpus et les gifs de Wumpus utillisés ont été créé et appartiennent à Discord inc. Cette application n'est pas
114 | affilié
115 | avec
116 | Discord inc.
🔽 Pamiętaj, aby przeczytać wszystkie informacje poniżej! 🔽
2 |
Krok 1
3 |
4 |
Kliknij fioletowy przycisk „Developer Portal”
5 |
Zaloguj się na swoje konto Discord
6 |
Kliknij „New Application” i nadaj jej nazwę! To będzie wyświetlana nazwa twojego szablonu.
7 |
(Opcjonalnie) Przejdź do karty „Rich Presence” i kliknij przycisk przesyłania, aby przesłać obrazy. Daj im
8 | krótkie, nazwy opisowe.
9 |
Zamknij okno Developer Portal.
10 |
11 |
Krok 2
12 |
13 |
Wróć do głównej aplikacji.
14 |
Nadaj swojemu szablonowi nazwę pliku (nie musi być taka sama jak nazwa aplikacji).
15 |
Wklej do ID Klienta. Jeśli jesteś w portalu dla deweloperów od kroku 1, powinien zostać skopiowany
16 | automatycznie.
17 |
Wypełnij pozostałe pola tyle, ile chcesz.
18 |
19 |
Zapoznaj się z poniższym diagramem, jeśli jesteś zdezorientowany!
20 |
21 |
Kliknij przycisk „Zapisz”
22 |
Kliknij przycisk „Uruchom szablon” i zobacz, jak twój szablon ożywa!
23 |
24 |
Upewnij się, że twój Discord jest otwarty, zanim klikniesz przycisk.
25 |
Musi to być aplikacja na komputer, a nie witryna.
26 |
Jeśli twój szablon się nie pojawi...
27 |
28 |
Upewnij się, że twój status nie jest niewidoczny / offline.
29 |
Upewnij się, że aktywność w grach jest włączona w ustawieniach Discorda.
30 |
Upewnij się, że kliknąłeś przycisk „Zapisz”, zanim kliknąłeś przycisk „Uruchom szablon”.
31 |
32 |
33 |
34 |
35 |
Diagram
36 |
37 |
Niestandardowe motywy
38 |
Jeśli zauważysz w ustawieniach (ikona koła zębatego w prawym dolnym rogu), ostatnią opcją dla motywów jest
39 | „Niestandardowe”. Aby utworzyć motyw niestandardowy:
40 |
41 |
42 |
Wróć do ekranu głównego
43 |
Kliknij przycisk „Pokaż w plikach”
44 |
Edytuj i zapisz plik custom.css. Kolory są w 6-literowym formacie szesnastkowym. Bardziej zaawansowana edycja
45 | wymaga podstawowej wiedzy o CSS.
46 |
Wybierz opcję Niestandardowy u dołu listy motywów.
47 |
48 |
49 |
Powszechne problemy
50 |
Pomocy, jestem zdezorientowany i postępowałem zgodnie z instrukcjami uruchamiania!
51 |
Nie bez powodu było tam duże ostrzeżenie. Wróć i przeczytaj zwykłe instrukcje instalacji.
52 |
Moje przyciski nie działają!
53 |
Discord nie pozwala na klikanie własnych przycisków. Jednak wszyscy inni mogą. To jest ograniczenie w Discord.
54 |
Nie widzę mojego szablonu!
55 |
Upewnij się, że nie jesteś niewidoczny / offline. Działa gdy twój status to online / zaraz wracam / nie przeszkadzać
56 |
57 |
58 |
Upewnij się, że nie masz innego programu zajmującego miejsce na szablon.
59 |
Wybierz kolejno Ustawienia > Aktywność w grze > Upewnij się, że opcja „Wyświetl aktualnie działającą grę jako
60 | status” jest włączona.
61 |
ISTNIEJE ZNANY BŁĄD W macOS 11, w którym czasami nie możesz zobaczyć swojej własnej obecności. Jednak inni
62 | ludzie mogą. To jest problem z klientem Discorda na macOS 11, a nie z moim programem.
63 |
Jeśli wszystko inne zawiedzie, całkowicie zamknij i uruchom ponownie Discorda.
64 |
65 |
Obraz(y) nie są wyświetlane!
66 |
Jeśli po prostu je umieścisz, czasami Discord'owi zajmuje około minuty, aby je prawidłowo buforować.
67 |
68 |
Autorzy
69 |
Deweloperzy
70 |
71 |
Tworzenie aplikacji, rozwój: ThatOneCalculator
72 |
Współtwórca, Projektant UI: KraXen72
73 |
74 |
Zastosowane komponenty
75 |
76 |
Wiele elementów CSS: Fosscord
77 |
Struktura (Framework): Electron
78 |
Narzędzie do tworzenia: electron-builder
79 |
Uruchomienie szablonów: discord-rpc by discord.js
80 |
81 |
Donatorzy
82 |
83 |
KingParity
84 |
Dylan Stone
85 |
Lil Fox YT
86 |
87 |
Tłumacze
88 |
89 |
Słowacki: KraXen72
90 |
Hiszpański: Jimmysit0
91 |
Chiński uproszczony: macpherson
92 |
Pendżabski: Toxician
93 |
Grecki: TheTaxPerson
94 |
Polski: Artugr18
95 |
Koreański: justiceserv
96 |
Irlandzki: fnionn
97 |
Węgierski: aprobeni
98 |
Niemiecki: nonamewastaken
99 |
Francuski: Cypooos
100 |
Holenderski: SAM
101 |
Rosyjski: NightStranger
102 |
Łotwie: Laaru
103 |
104 |
Pomocnicy Discorda
105 |
106 |
Cyanomous#1001
107 |
Dylanstone#0001
108 |
KingParity#7362
109 |
Lumi/Steve the Catboy#7948
110 |
Toxician#4225
111 |
zeta#0700
112 |
113 |
Prawa autorskie
114 |
Użyte gify Wumpus i obrazy Wumpus zostały zaprojektowane i są własnością Discord inc. Ta aplikacja nie jest
115 | oficjalnie powiązana z Discord inc.
Klicke auf "New Application" und gib einen Namen an! Dies wird der Anzeigename deiner Präsenz sein.
7 |
(Optional) Gehe in den "Rich Presence" Tab, und klicke auf "hochladen" um Bilder hochzuladen. Gib ihnen kurze
8 | deskriptive Namen.
9 |
Schließe das Developer Portal Fenster.
10 |
11 |
Schritt 2
12 |
13 |
Gehe zum Hauptprogramm zurück.
14 |
Gib der Präsenz einen Dateinamen (muss nicht mit dem App-Namen).
15 |
Füge die Client ID ein. Wenn du im Developer Portal aus Schritt 1 warst sollte sie automatisch kopiert worden
16 | sein.
17 |
Fülle die restlichen Felder so viel du willst aus.
18 |
19 |
Falls du verwirrt bist schaue dir das Diagramm unten an!
20 |
21 |
Klicke auf den "Speichern" Knopf.
22 |
Klicke nun auf den "Präsenz starten" Knopf und sehe zu wie deine Präsenz an springt!
23 |
24 |
Stelle sicher das Discord gestartet ist, bevor du den Knopf drückst.
25 |
Du musst die Desktop-App benutzen, nicht die web Version.
26 |
Falls deine Präsenz nicht erscheint...
27 |
28 |
Gehe sicher, dass dein Status nicht auf offline/unsichtbar gestellt ist.
29 |
Gehe sicher, dass Spiel Aktivität in den Discord Einstellungen aktiviert ist.
30 |
Gehe sicher, dass du vor dem Starten gespeichert hast.
31 |
32 |
33 |
34 |
35 |
Diagramm
36 |
37 |
Benutzerdefinierte Designs
38 |
Falls es dir in den Einstellungen (Zahnrad Icon unten rechts) noch nicht aufgefallen ist, die Letzte Design-Option
39 | ist "Benutzerdefiniert". Um ein Benutzerdefiniertes Design zu erstellen:
40 |
41 |
42 |
Gehe zum Hauptmenü zurück.
43 |
Klick auf den "In Dateien anzeigen" Knopf
44 |
Bearbeite und speicher die custom.css Datei. Die Farben sind in dem 6-Buchstaben hex Format. Fortgeschrittenere
45 | Änderungen benötigen grundlegende css Kenntnisse.
46 |
Wähle custom aus der Design liste aus.
47 |
48 |
49 |
Häufige Probleme
50 |
Hilfe, ich bin verwirrt und habe den "run from source" Anleitungen gefolgt!
51 |
Die große Warnung dort hat einen Grund. Probier die normalen installations Anweisungen.
52 |
Meine Knöpfe funktionieren nicht!
53 |
Discord lässt dich nicht deine eigenen knöpfe anklicken, jeder andere kann dies! Dieses Problem liegt an Discord.
54 |
Ich kann meine Präsenz nicht sehen!
55 |
Gehe sicher, dass dein Status nicht auf offline/unsichtbar gestellt ist. Falls du nicht offline/unsichtbar bist...
56 |
57 |
58 |
Gehe sicher kein anderes Programm zeigt gerade etwas in deiner Präsenz an.
59 |
Gehe in die Einstellungen > Spielaktivität > Gehe sicher, dass "Derzeit ausgeführtes Spiel als Statusmeldung
60 | anzeigen" AN ist.
61 |
ES GIBT EINEN BEKANNTEN BUG IN macOS 11, durch den man manchmal seine eigene Präsenz nicht sehen kann, andere
62 | können dies aber trotzdem.
63 | Dieses Problem liegt an Discord's macOS Client, nicht an meinem Programm.
64 |
Falls alles andere nicht funktioniert starte Discord neu.
65 |
66 |
Die Bilder/das Bild werden/wird nicht angezeigt!
67 |
Wenn du sie erst vor kurzem eingefügt hast Braucht Discord manchmal ein paar Minuten um diese richtig zu cachen.
68 |
69 |
Credits
70 |
Entwickler
71 |
72 |
App Erstellung, Entwicklung: ThatOneCalculator
73 |
Co-entwickler, UI Designer: KraXen72
74 |
75 |
Genutzte Komponenten
76 |
77 |
Viele css Elemente: Fosscord
78 |
Framework: Electron
79 |
Build tool: electron-builder
80 |
Präsenz Starter: discord-rpc by discord.js
81 |
82 |
Spender
83 |
84 |
KingParity
85 |
Dylan Stone
86 |
Lil Fox YT
87 |
88 |
Übersetzer
89 |
90 |
Slovakisch: KraXen72
91 |
Spanisch: Jimmysit0
92 |
Vereinfachtes Chinesisch: macpherson
93 |
Punjabi: Toxician
94 |
Griechisch: TheTaxPerson
95 |
Polnisch: Artugr18
96 |
Koreanisch: justiceserv
97 |
Irisch: fnionn
98 |
Ungarisch: aprobeni
99 |
Deutsch: nonamewastaken
100 |
Französisch: Cypooos
101 |
Niederländisch: SAM
102 |
Russisch: NightStranger
103 |
Lettland: Laaru
104 |
105 |
Discord Helfer
106 |
107 |
Cyanomous#1001
108 |
Dylanstone#0001
109 |
KingParity#7362
110 |
Lumi/Steve the Catboy#7948
111 |
Toxician#4225
112 |
zeta#0700
113 |
114 |
Copyright credits
115 |
Wumpus und die genutzten Wumpus gifs wurden von Discord inc. designt und sind ihr Besitz. Dieses Programm ist nicht
116 | offiziell mit
117 | Discord inc. verbunden.
118 |
🔽 Kérlek olvasd el az egészet, az elejétől a végéig! 🔽
2 |
Első lépés
3 |
4 |
Kattints rá a lila "Fejlesztői Portál" gombra
5 |
Jelentkezz be a Discord fiókodba
6 |
Kattints rá az "Új applikáció" gombra, és adj neki egy nevet! Ez lesz a megjelenés neve.
7 |
(Nem kötelező) Menj rá a "Rich Presence" szekcióra, és tölts fel képeket a "Feltöltés" gomb megnyomásával. Adj
8 | nekik rövid, egyszerű, és megjegyezhető nevet.
9 |
Zárd be az Fejlesztői Portált.
10 |
11 |
Második lépés
12 |
13 |
Lépj vissza a fő programba
14 |
Adj a megjelenésednek egy fájl nevet (nem kell ugyanannak lennie, mint az app neve)
15 |
Másold be a Kliens ID-t. Ha az első lépést megcsináltad, automatikusan ki van másolva.
16 |
Töltsd ki a többi mezőt úgy, ahogy akarod
17 |
18 |
Segítséghez nézd az alsó képet!
19 |
20 |
Kattints a "Mentés" gombra
21 |
Kattints a "Megjelenés bekapcsolása" gombra, és nézd, ahogy életre kel a megjelenés!
22 |
23 |
Mielőtt rányomsz a gombra, legyen elindítva a Discord!
24 |
Nem lehet a webes Discord, az asztali programot kell használnod!
25 |
Amennyiben nem jelenik meg a megjelenésed...
26 |
27 |
Menj biztosra, hogy a státuszod nincs-e offline/láthatatlan módban.
28 |
Menj biztosra, hogy be van kapcsolva a Játék Tevékenység megjelenítése a Discord beállításokban.
29 |
30 |
Nézd meg, hogy biztosan rányomtál-e a "Mentés" gombra, mielőtt megnyomtad a "Megjelenés
31 | bekapcsolása" gombot.
32 |
33 |
34 |
35 |
36 |
Diagram
37 |
38 |
Saját téma készítés
39 |
Amennyiben észrevetted, hogy a beállításokban (jobb fenti csapágy ikon), az utolsó opció a témákhoz az, hogy "Saját".
40 | Így tudsz csinálni saját témát:
41 |
42 |
43 |
Menj vissza a főképernyőre
44 |
Kattints rá a "Fájlok mutatása könyvtárban" gombra
45 |
Változtatsd meg, majd menjts el a custom.css file-t. A színek legyenek 6 karakteres, hex formátumban. Ha jobban
46 | szeretnél foglalkozni ezzel, ahhoz szükséges alap CSS tudás.
47 |
Select Custom from the bottom of the theme list.
48 |
49 |
50 |
Gyakori problémák
51 |
Segítség, zavarodott vagyok, és követtem mindent a forrás utasításai alapján!
52 |
There was a big warning there for a reason. Go back and read the regular install instructions, ya goober.
53 |
Nem működnek a gombjaim!
54 |
A Discord nem engedi, hogy a saját gombjaidra kattints. Viszont, mások rátudnak kattintani. Ez egy Discordon belüli
55 | limitáció.
56 |
Nem látom a megjelenést!
57 |
ellenőrizd le, hogy nem vagy-e offline/láthatatlan módban. Amennyiben online/alvó/ne zavarj módban vagy...
58 |
59 |
Nézd meg, hogy nincs-e egy másik futó program, ami szintén a megjelenésedet állítaná be.
60 |
Menj a Beállítások > Játék Tevékenység > szekcióhoz, és ellenőrizd le, hogy a "A jelenleg futó játék
61 | megjelenítése állapotüzenetként" be van kapcsolva.
62 |
Van egy TUDOTT hiba macOS 11-en, ahol néha nem látod a saját megjelenésedet, viszont mások látják. Ez egy
63 | Discord macOS 11 klienshiba, nem az én programomé.
64 |
Amennyiben ezek közül egyik sem oldja meg, zárd be teljesen a Discordot, és indítsd el újra.
65 |
66 |
A kép(ek) nem jelenik/jelennek meg!
67 |
Ha csak behúzod, a Discordnak néha időre lesz szüksége (akár percekre), hogy eltárolja őket.
68 |
69 |
Kreditek
70 |
Fejlesztők
71 |
72 |
App készítés, fejlesztés: ThatOneCalculator
73 |
Társhejlesztő, UI dizájner: KraXen72
74 |
75 |
Felhasznált komponensek
76 |
77 |
Sok CSS rész: Fosscord
78 |
Keretrendszer: Electron
79 |
Felépítő eszköz: electron-builder
80 |
Megjelenés indítása: discord-rpc by discord.js
81 |
82 |
Támogatók
83 |
84 |
justiceserv
85 |
KingParity
86 |
Dylan Stone
87 |
Lil Fox YT
88 |
Jorc0
89 |
90 |
Fordítók
91 |
92 |
Szlovák: KraXen72
93 |
Spanyol: Jimmysit0
94 |
Egyszerűsített kínai: macpherson
95 |
Pandzsábi: Toxician
96 |
Görög: TheTaxPerson
97 |
Lengyel: Artugr18
98 |
Koreai: justiceserv
99 |
Ír: fnionn
100 |
Magyar: aprobeni
101 |
Német: nonamewastaken
102 |
Francia: Cypooos
103 |
Holland: SAM
104 |
Orosz: NightStranger
105 |
Lettország: Laaru
106 |
107 |
Discord segítők
108 |
109 |
Cyanomous#1001
110 |
Dylanstone#0001
111 |
KingParity#7362
112 |
Lumi/Steve the Catboy#7948
113 |
Toxician#4225
114 |
zeta#0700
115 |
116 |
Copyright credits
117 |
Wumpus és a Wumpus gifek a Discord inc. által lettel készítve, és ők is ennek tulajdonosai. A programnak semmilyen
118 | hivatalos köze nincs a Discord-hoz.
Click "New Application", and give it a name! This will be the display name of your presence.
7 |
(Optional) Head over to the "Rich Presence" tab, and click the upload button to upload images. Give them short,
8 | descriptive names.
9 |
Close the Developer Portal window.
10 |
11 |
Step 2
12 |
13 |
Head back to the main application.
14 |
Give your presence a file name (doesn't have to be same as the app name).
15 |
Paste into Client ID. If you were in the developer portal from step 1, it should've copied automatically.
16 |
Fill out the rest of the fields as much as you want.
17 |
18 |
Refer to the diagram below if you're confused!
19 |
20 |
Click the "Save" button
21 |
Click the "Launch Presence" button, and watch your presence spring to life!
22 |
23 |
Make sure Discord is open before clicking the button.
24 |
It has to be the Desktop app, not the website.
25 |
If your presence doesn't show up...
26 |
27 |
Make sure your status isn't invisible/offline.
28 |
Make sure game activity is on in Discord's settings.
29 |
Make sure you clicked the "Save" button before you clicked the "Launch Presence" button.
30 |
31 |
32 |
33 |
34 |
Diagram
35 |
36 |
Custom theming
37 |
If you notice in settings (bottom right gear icon), the last option for themes is "Custom". To make a custom theme:
38 |
39 |
40 |
Go back to the main screen
41 |
Click the "Show in files" button
42 |
Edit and save the custom.css file. The colors are in the 6-letter hex format. More advanced editing requires
43 | basic CSS knowledge.
44 |
Select Custom from the bottom of the theme list.
45 |
46 |
47 |
CLI Instructions
48 |
For users that know what they're doing, you can run
49 | discordrpcmaker <file> in the terminal, where
50 | file is the file name of the presence you want to launch, which can be found under each presence name
51 | on the sidebar.
52 |
53 |
Common issues
54 |
Help, I'm confused and followed the run from source instructions!
55 |
There was a big warning there for a reason. Go back and read the regular install instructions, ya goober.
56 |
My buttons aren't working!
57 |
Discord doesn't let you click your own buttons. However, everyone else can. This is a limitation with Discord.
58 |
I can't see the presence!
59 |
Make sure you are not invisible/offline. If you ARE online/idle/dnd...
60 |
61 |
Make sure you don't have another program taking up a presence slot.
62 |
Go to Settings > Game Activity > Make sure "Display currently running game as a status message" is ON.
63 |
THERE IS A KNOWN BUG IN macOS 11, where sometimes you can't see your own presence. However, other people can.
64 | This is a problem with Discord's macOS 11 client, not my program.
65 |
If all else fails, completely close and relaunch Discord.
66 |
67 |
The image(s) aren't showing!
68 |
If you just put them in, sometimes Discord takes a minute or so to cache them properly.
69 |
70 |
Credits
71 |
Developers
72 |
73 |
App creation, development: ThatOneCalculator
74 |
Co-developer, UI designer: KraXen72
75 |
76 |
Components used
77 |
78 |
Lots of CSS elements: Fosscord-UI
79 |
Framework: Electron
80 |
Build tool: electron-builder
81 |
Presence launching: discord-rpc by discord.js
82 |
83 |
Donators
84 |
85 |
JusticeServ
86 |
KingParity
87 |
Dylan Stone
88 |
Lil Fox YT
89 |
Jorc0
90 |
Funnion
91 |
92 |
Translators
93 |
94 |
Slovak: KraXen72
95 |
Spanish: Jimmysit0
96 |
Simplified Chinese: macpherson
97 |
Punjabi: Toxician
98 |
Greek: TheTaxPerson
99 |
Polish: Artugr18
100 |
Korean: JusticeServ
101 |
Irish: fnionn
102 |
Hungarian: aprobeni
103 |
German: nonamewastaken
104 |
French: Cypooos
105 |
Dutch: SAM
106 |
Russian: NightStranger
107 |
Latvian: Laaru
108 |
109 |
Discord helpers
110 |
111 |
Cyanomous#1001
112 |
Dylanstone#0001
113 |
KingParity#7362
114 |
Lumi/Steve the Catboy#7948
115 |
Toxician#4225
116 |
zeta#0700
117 |
118 |
Art
119 |
120 |
Promo art: MiKEY
121 |
Logo: ThatOneCalculator
122 |
Wumpus gifs: Discord
123 |
124 |
126 |
Copyright notice
127 |
This application is licensed under the GPL-3 license.
128 |
Wumpus and the Wumpus gifs used are designed and owned by Discord inc. This application is not officially affiliated
129 | with
130 | Discord inc.
Noklikšķiniet uz violetas pogas “Izstrādātāja portāls”
5 |
Pierakstieties savā Discord kontā
6 |
Noklikšķiniet uz 'Jauna lietojumprogramma' un piešķiriet tai nosaukumu! Tas būs jūsu klātbūtnes redzamais nosaukums.
7 |
(Neobligāti) Dodieties uz cilni “Bagāta klātbūtne” un noklikšķiniet uz augšupielādes pogas, lai augšupielādētu attēlus. Dodiet viņiem īsu,
8 | aprakstošie nosaukumi.
9 |
Aizveriet izstrādātāja portāla logu.
10 |
11 |
2. solis
12 |
13 |
Atgriezieties atpakaļ galvenajā lietojumprogrammā.
14 |
Piešķiriet savai klātbūtnei faila nosaukumu (tam nav jābūt vienādam ar lietotnes nosaukumu).
15 |
Ielīmēt klienta ID. Ja no 1. soļa esat bijis izstrādātāja portālā, tas būtu jākopē automātiski.
16 |
Aizpildiet pārējos laukus, cik vēlaties.
17 |
18 |
Ja esat apmulsis, skatiet zemāk redzamo diagrammu!
19 |
20 |
Noklikšķiniet uz pogas "Saglabāt"
21 |
Noklikšķiniet uz pogas “Uzsākt klātbūtni” un skatieties, kā jūsu klātbūtne atdzīvojas!
22 |
23 |
Pirms noklikšķināt uz pogas, pārliecinieties, ka Discord ir atvērtas.
24 |
Tam jābūt lietotnei Desktop, nevis vietnei.
25 |
If your presence doesn't show up...
26 |
27 |
Pārliecinieties, vai jūsu statuss nav neredzams/bezsaistē.
28 |
Pārliecinieties, vai spēles darbības ir ieslēgtas Discord iestatījumos.
29 |
Pirms noklikšķināt uz pogas Sākt klātbūtni, pārliecinieties, ka esat noklikšķinājis uz pogas Saglabāt.
30 |
31 |
32 |
33 |
34 |
Diagramma
35 |
36 |
Pielāgota tematika
37 |
Ja pamanāt iestatījumos (apakšējā labajā pusē esošā zobrata ikona), pēdējā motīvu opcija ir "Custom". Lai izveidotu pielāgotu motīvu:
38 |
39 |
40 |
Atgriezieties galvenajā ekrānā
41 |
Noklikšķiniet uz pogas "Rādīt failos"
42 |
Rediģējiet un saglabājiet failu custom.css. Krāsas ir sešu burtu hex formātā. Nepieciešama uzlabota rediģēšana
43 | vajadzīgas CSS pamatzināšanas.
44 |
Motīvu saraksta apakšdaļā atlasiet Custom.
45 |
46 |
47 |
CLI Instrukcijas
48 |
Varat palaist lietotājiem, kuri zina, ko viņi dara discordrpcmaker <faila> terminālā, kur faila ir tās klātbūtnes faila nosaukums, kuru vēlaties sākt, kas atrodams zem katra sānjoslas klātbūtnes nosaukuma.
49 |
50 |
Kopīgi jautājumi
51 |
Palīdziet, es esmu neizpratnē un sekoju līdzi avota instrukcijām!
52 |
Ne velti tur bija liels brīdinājums. Atgriezieties un izlasiet parastās instalēšanas instrukcijas.
53 |
Manas pogas nedarbojas!
54 |
Nesaskaņas neļauj jums noklikšķināt uz savām pogām. Tomēr visi pārējie to var. Tas ir ierobežojums attiecībā uz Discord.
55 |
Es neredzu klātbūtni!
56 |
Pārliecinieties, ka neesat redzams/bezsaistē. Ja esat tiešsaistē/dīkstāvē/dnd...
57 |
58 |
Pārliecinieties, vai jums nav citas programmas, kas aizņemtu klātbūtnes slotu.
59 |
(Dodieties uz sadaļu Iestatījumi > Spēļu darbība > Pārliecinieties) Vai opcija “Rādīt pašreizējo spēli kā statusa ziņojumu” ir ieslēgta.
60 |
MacOS 11 ir zināma kļūda, kur dažreiz jūs nevarat redzēt savu klātbūtni. Tomēr citi cilvēki to var.
61 | Šī ir problēma ar Discord's macOS 11 klientu, nevis manu programmu.
62 |
Ja nekas cits neizdodas, pilnībā aizveriet un restartējiet Discord.
63 |
64 |
Attēls (-i) netiek rādīti (-i)!
65 |
Ja jūs tos vienkārši ievietojat, dažreiz Discord prasa apmēram minūti, lai tos pareizi saglabātu kešatmiņā.
66 |
67 |
Kredīti
68 |
Izstrādātāji
69 |
70 |
Lietotņu izveide, izstrāde: ThatOneCalculator
71 |
Līdzizstrādātājs, lietotāja saskarnes dizainers: KraXen72
72 |
73 |
Izmantotie komponenti
74 |
75 |
Daudz CSS elementu: Fosscord-UI
76 |
Sistēma: Electron
77 |
Veidošanas rīks: electron-builder
78 |
Klātbūtnes palaišana: discord-rpc pēc discord.js
79 |
80 |
Ziedotāji
81 |
82 |
JusticeServ
83 |
KingParity
84 |
Dylan Stone
85 |
Lil Fox YT
86 |
Jorc0
87 |
Funnion
88 |
89 |
Tulkotāji
90 |
91 |
Slovāku: KraXen72
92 |
Spāņu: Jimmysit0
93 |
Vienkāršota ķīniešu: macpherson
94 |
Pandžabi: Toxician
95 |
GreekGrieķu: TheTaxPerson
96 |
Poļu: Artugr18
97 |
Korejiešu: JusticeServ
98 |
Īru: fnionn
99 |
Ungāru: aprobeni
100 |
Vācu: nonamewastaken
101 |
Franču: Cypooos
102 |
Holandiešu: SAM
103 |
Krievu: NightStranger
104 |
Latvietis: Laaru
105 |
106 |
Discorda palīgi
107 |
108 |
Cyanomous#1001
109 |
Dylanstone#0001
110 |
KingParity#7362
111 |
Lumi/Steve the Catboy#7948
112 |
Toxician#4225
113 |
zeta#0700
114 |
115 |
Māksla
116 |
117 |
Promo māksla: MiKEY
118 |
Logotips: ThatOneCalculator
119 |
Wumpus gifs: Discord
120 |
121 |
123 |
CPaziņojums par autortiesībām
124 |
Šī lietojumprogramma ir licencēta saskaņā ar GPL-3 licenci.
125 |
Wumpus un izmantotie Wumpus gifi ir izstrādāti un pieder Discord inc. Šis pieteikums nav oficiāli saistīts
126 | ar
127 | Discord inc.
128 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://drpcm.t1c.dev/)
2 | ## ⬇️ Scroll down for install instructions! ⬇️
3 |
4 | [](https://discord.gg/Z7UZPR3bbW)
5 | [](https://github.com/thatonecalculator/discordrpcmaker)
6 | [](https://buymeacoffee.com/that1calculator)
7 | [](https://www.npmjs.com/discordrpcmaker)
8 |
9 | 
10 | 
11 | 
12 |
13 | [](https://discord.gg/Z7UZPR3bbW)
14 |
15 | ## Features
16 |
17 | - [x] Clickable buttons!
18 | - [x] Make and manage multiple presences
19 | - [x] Clean and lightweight UI
20 | - [x] Clear instructions
21 | - [x] Optional timer
22 | - [x] Custom, simplified developer portal
23 | - [x] Easy installers for Windows, macOS, and Linux
24 | - [x] Export presences and share with friends
25 | - [x] Multiple themes
26 | - [x] Cross-platform system tray support
27 | - [x] Auto-update
28 | - [x] Pywal support
29 | - [x] AUR Package
30 | - [x] CLI support
31 | - [ ] Code signing on Windows (soon)
32 | - [ ] Translations (soon)
33 | - [ ] Hotkeys (soon)
34 | - [ ] Online sharing (future)
35 |
36 | ---
37 |
38 | ## Install
39 | ###### Version 2.0.9
40 |
41 | #### [Windows ](https://github.com/ThatOneCalculator/DiscordRPCMaker/releases/download/v2.0.9/discordrpcmaker-windows.exe)
42 |
43 | - Download the exe, click More Info > Run Anyway > Open Discord RPC Maker from the desktop shortcut or start menu
44 |
45 | ---
46 |
47 | #### [macOS ](https://github.com/ThatOneCalculator/DiscordRPCMaker/releases/download/v2.0.9/discordrpcmaker-macos.dmg)
48 |
49 | - Download & mount the dmg, drag Discord RPC Maker into the Applications folder > Double click on Applications folder > Right click Discord RPC Maker > Open > Open
50 |
51 | ---
52 |
53 | #### [AppImage (all Linux distros)  ](https://github.com/ThatOneCalculator/DiscordRPCMaker/releases/download/v2.0.9/discordrpcmaker-linux.appimage)
54 |
55 | - Download and run. Easy!
56 |
57 | #### [AUR package (discordrpcmaker)](https://aur.archlinux.org/packages/discordrpcmaker/) 
58 |
59 | - `yay -S discordrpcmaker` (replace `yay` with your AUR helper of choice)
60 |
61 | #### [.deb (Ubuntu/Debian based Linux distros)  ](https://github.com/ThatOneCalculator/DiscordRPCMaker/releases/download/v2.0.9/discordrpcmaker-linux.deb)
62 |
63 | - Download, `sudo apt install /path/to/discordrpcmaker-linux.deb` or open with GDebi/Eddy.
64 |
65 | #### [.rpm (RPM based Linux distros)  ](https://github.com/ThatOneCalculator/DiscordRPCMaker/releases/download/v2.0.9/discordrpcmaker-linux.rpm)
66 |
67 | - Download, `sudo rpm -i /path/to/discordrpcmaker-linux.rpm`
68 |
69 | #### [Tarball (all Linux distros) ](https://github.com/ThatOneCalculator/DiscordRPCMaker/releases/download/v2.0.9/discordrpcmaker-linux.tar.gz)
70 |
71 | - Download, `tar -xvf /path/to/discordrpcmaker-linux.tar.gz` > Run: `discordrpcmaker-2.0.9/discordrpcmaker`; To install, `mv ./discordrpcmaker-2.0.9 /bin/drpcm && ln -s /bin/drpcm/discordrpcmaker /bin/discordrpcmaker`, and run `discordrpcmaker`.
72 |
73 | ---
74 |
75 | #### From source 
76 | ###### ⚠ Don't do this unless you intend to modify the code!
77 | - Install NodeJS/NPM, Yarn, & Electron
78 | - `git clone https://github.com/thatonecalculator/discordrpcmaker && cd discordrpcmaker && yarn install && npm run start`
79 |
80 | ---
81 |
82 | ## Supporters
83 | You can [](https://buymeacoffee.com/that1calculator) to get your name here!
84 |
85 | We're trying to raise $150 to pay for online services for the next update and code signing!
86 |
87 | - [**JusticeServ**](https://github.com/justiceserv)
88 | - [**KingParity**](https://twitter.com/KingParity)
89 | - [**Dylan Stone**](https://twitter.com/notDylanstone)
90 | - [**Lil Fox YT**](https://twitter.com/TMBF_YT)
91 | - [**Jorc0**](https://twitter.com/Jorcus334)
92 | - [**Funnion**](https://nion.fun/)
93 |
94 | ---
95 |
96 | ## Still need help, or just want to chat?
97 | [Open a new issue here](https://github.com/ThatOneCalculator/DiscordRPCMaker/issues) or [join the Discord!](https://discord.gg/Z7UZPR3bbW)
98 |
99 | Made by [ThatOneCalculator](https://t1c.dev) and [KraXen72](https://github.com/kraxen72). Not officially affiliated with Discord. Thank you [discord.js](https://github.com/discordjs/rpc/), [electron-builder](https://electron.build), [fosscord-ui](https://github.com/fosscord/fosscord-ui), and all our lovely stargazers, helpers, translators, and users for making this project possible. Full credits are in the Instructions & Info menu in the program.
100 |
--------------------------------------------------------------------------------
/style/normalize.css:
--------------------------------------------------------------------------------
1 | /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
2 |
3 | /* Document
4 | ========================================================================== */
5 |
6 | /**
7 | * 1. Correct the line height in all browsers.
8 | * 2. Prevent adjustments of font size after orientation changes in iOS.
9 | */
10 |
11 | html {
12 | line-height: 1.15; /* 1 */
13 | -webkit-text-size-adjust: 100%; /* 2 */
14 | }
15 |
16 | /* Sections
17 | ========================================================================== */
18 |
19 | /**
20 | * Remove the margin in all browsers.
21 | */
22 |
23 | body {
24 | margin: 0;
25 | }
26 |
27 | /**
28 | * Render the `main` element consistently in IE.
29 | */
30 |
31 | main {
32 | display: block;
33 | }
34 |
35 | /**
36 | * Correct the font size and margin on `h1` elements within `section` and
37 | * `article` contexts in Chrome, Firefox, and Safari.
38 | */
39 |
40 | h1 {
41 | font-size: 2em;
42 | margin: 0.67em 0;
43 | }
44 |
45 | /* Grouping content
46 | ========================================================================== */
47 |
48 | /**
49 | * 1. Add the correct box sizing in Firefox.
50 | * 2. Show the overflow in Edge and IE.
51 | */
52 |
53 | hr {
54 | box-sizing: content-box; /* 1 */
55 | height: 0; /* 1 */
56 | overflow: visible; /* 2 */
57 | }
58 |
59 | /**
60 | * 1. Correct the inheritance and scaling of font size in all browsers.
61 | * 2. Correct the odd `em` font sizing in all browsers.
62 | */
63 |
64 | pre {
65 | font-family: monospace, monospace; /* 1 */
66 | font-size: 1em; /* 2 */
67 | }
68 |
69 | /* Text-level semantics
70 | ========================================================================== */
71 |
72 | /**
73 | * Remove the gray background on active links in IE 10.
74 | */
75 |
76 | a {
77 | background-color: transparent;
78 | }
79 |
80 | /**
81 | * 1. Remove the bottom border in Chrome 57-
82 | * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
83 | */
84 |
85 | abbr[title] {
86 | border-bottom: none; /* 1 */
87 | text-decoration: underline; /* 2 */
88 | text-decoration: underline dotted; /* 2 */
89 | }
90 |
91 | /**
92 | * Add the correct font weight in Chrome, Edge, and Safari.
93 | */
94 |
95 | b,
96 | strong {
97 | font-weight: bolder;
98 | }
99 |
100 | /**
101 | * 1. Correct the inheritance and scaling of font size in all browsers.
102 | * 2. Correct the odd `em` font sizing in all browsers.
103 | */
104 |
105 | code,
106 | kbd,
107 | samp {
108 | font-family: monospace, monospace; /* 1 */
109 | font-size: 1em; /* 2 */
110 | }
111 |
112 | /**
113 | * Add the correct font size in all browsers.
114 | */
115 |
116 | small {
117 | font-size: 80%;
118 | }
119 |
120 | /**
121 | * Prevent `sub` and `sup` elements from affecting the line height in
122 | * all browsers.
123 | */
124 |
125 | sub,
126 | sup {
127 | font-size: 75%;
128 | line-height: 0;
129 | position: relative;
130 | vertical-align: baseline;
131 | }
132 |
133 | sub {
134 | bottom: -0.25em;
135 | }
136 |
137 | sup {
138 | top: -0.5em;
139 | }
140 |
141 | /* Embedded content
142 | ========================================================================== */
143 |
144 | /**
145 | * Remove the border on images inside links in IE 10.
146 | */
147 |
148 | img {
149 | border-style: none;
150 | }
151 |
152 | /* Forms
153 | ========================================================================== */
154 |
155 | /**
156 | * 1. Change the font styles in all browsers.
157 | * 2. Remove the margin in Firefox and Safari.
158 | */
159 |
160 | button,
161 | input,
162 | optgroup,
163 | select,
164 | textarea {
165 | font-family: inherit; /* 1 */
166 | font-size: 100%; /* 1 */
167 | line-height: 1.15; /* 1 */
168 | margin: 0; /* 2 */
169 | }
170 |
171 | /**
172 | * Show the overflow in IE.
173 | * 1. Show the overflow in Edge.
174 | */
175 |
176 | button,
177 | input {
178 | /* 1 */
179 | overflow: visible;
180 | }
181 |
182 | /**
183 | * Remove the inheritance of text transform in Edge, Firefox, and IE.
184 | * 1. Remove the inheritance of text transform in Firefox.
185 | */
186 |
187 | button,
188 | select {
189 | /* 1 */
190 | text-transform: none;
191 | }
192 |
193 | /**
194 | * Correct the inability to style clickable types in iOS and Safari.
195 | */
196 |
197 | button,
198 | [type="button"],
199 | [type="reset"],
200 | [type="submit"] {
201 | -webkit-appearance: button;
202 | }
203 |
204 | /**
205 | * Remove the inner border and padding in Firefox.
206 | */
207 |
208 | button::-moz-focus-inner,
209 | [type="button"]::-moz-focus-inner,
210 | [type="reset"]::-moz-focus-inner,
211 | [type="submit"]::-moz-focus-inner {
212 | border-style: none;
213 | padding: 0;
214 | }
215 |
216 | /**
217 | * Restore the focus styles unset by the previous rule.
218 | */
219 |
220 | button:-moz-focusring,
221 | [type="button"]:-moz-focusring,
222 | [type="reset"]:-moz-focusring,
223 | [type="submit"]:-moz-focusring {
224 | outline: 1px dotted ButtonText;
225 | }
226 |
227 | /**
228 | * Correct the padding in Firefox.
229 | */
230 |
231 | fieldset {
232 | padding: 0.35em 0.75em 0.625em;
233 | }
234 |
235 | /**
236 | * 1. Correct the text wrapping in Edge and IE.
237 | * 2. Correct the color inheritance from `fieldset` elements in IE.
238 | * 3. Remove the padding so developers are not caught out when they zero out
239 | * `fieldset` elements in all browsers.
240 | */
241 |
242 | legend {
243 | box-sizing: border-box; /* 1 */
244 | color: inherit; /* 2 */
245 | display: table; /* 1 */
246 | max-width: 100%; /* 1 */
247 | padding: 0; /* 3 */
248 | white-space: normal; /* 1 */
249 | }
250 |
251 | /**
252 | * Add the correct vertical alignment in Chrome, Firefox, and Opera.
253 | */
254 |
255 | progress {
256 | vertical-align: baseline;
257 | }
258 |
259 | /**
260 | * Remove the default vertical scrollbar in IE 10+.
261 | */
262 |
263 | textarea {
264 | overflow: auto;
265 | }
266 |
267 | /**
268 | * 1. Add the correct box sizing in IE 10.
269 | * 2. Remove the padding in IE 10.
270 | */
271 |
272 | [type="checkbox"],
273 | [type="radio"] {
274 | box-sizing: border-box; /* 1 */
275 | padding: 0; /* 2 */
276 | }
277 |
278 | /**
279 | * Correct the cursor style of increment and decrement buttons in Chrome.
280 | */
281 |
282 | [type="number"]::-webkit-inner-spin-button,
283 | [type="number"]::-webkit-outer-spin-button {
284 | height: auto;
285 | }
286 |
287 | /**
288 | * 1. Correct the odd appearance in Chrome and Safari.
289 | * 2. Correct the outline style in Safari.
290 | */
291 |
292 | [type="search"] {
293 | -webkit-appearance: textfield; /* 1 */
294 | outline-offset: -2px; /* 2 */
295 | }
296 |
297 | /**
298 | * Remove the inner padding in Chrome and Safari on macOS.
299 | */
300 |
301 | [type="search"]::-webkit-search-decoration {
302 | -webkit-appearance: none;
303 | }
304 |
305 | /**
306 | * 1. Correct the inability to style clickable types in iOS and Safari.
307 | * 2. Change font properties to `inherit` in Safari.
308 | */
309 |
310 | ::-webkit-file-upload-button {
311 | -webkit-appearance: button; /* 1 */
312 | font: inherit; /* 2 */
313 | }
314 |
315 | /* Interactive
316 | ========================================================================== */
317 |
318 | /*
319 | * Add the correct display in Edge, IE 10+, and Firefox.
320 | */
321 |
322 | details {
323 | display: block;
324 | }
325 |
326 | /*
327 | * Add the correct display in all browsers.
328 | */
329 |
330 | summary {
331 | display: list-item;
332 | }
333 |
334 | /* Misc
335 | ========================================================================== */
336 |
337 | /**
338 | * Add the correct display in IE 10+.
339 | */
340 |
341 | template {
342 | display: none;
343 | }
344 |
345 | /**
346 | * Add the correct display in IE 10.
347 | */
348 |
349 | [hidden] {
350 | display: none;
351 | }
352 |
--------------------------------------------------------------------------------
/main.js:
--------------------------------------------------------------------------------
1 | // libappindicator-gtk3 on Arch as req
2 | const { app, BrowserWindow, Notification, Menu, MenuItem, ipcMain, Tray, dialog } = require("electron")
3 | const path = require('path')
4 | const fs = require('fs')
5 | const os = require('os')
6 | const RPC = require('discord-rpc')
7 | const EventEmitter = require('events')
8 | require('@electron/remote/main').initialize()
9 | const iconpath = path.join(__dirname, "/assets/icon.png")
10 | const loadingEvents = new EventEmitter()
11 | const slash = os.platform() == 'win32' ? "\\" : "/"
12 | let dir = `${os.userInfo().homedir}/${process.platform === 'win32' ? '/AppData/Roaming/drpcm/' : '/.config/drpcm/'}`
13 | let opendir = dir.replaceAll("/", "\\").replaceAll("\\\\", "\\")
14 |
15 | let win = null
16 |
17 | const args = process.argv.slice(2)
18 | const id = args[0]
19 |
20 | if (id !== undefined) {
21 | const slash = os.platform() == 'win32' ? "\\" : "/"
22 | const dir = `${os.userInfo().homedir}/${process.platform === 'win32' ? '/AppData/Roaming/drpcm/' : '/.config/drpcm/'}`
23 | let client = new RPC.Client({ transport: 'ipc' })
24 |
25 | let opendir = dir.replace("/", "\\").replace("\\\\", "\\")
26 | let fullpath = os.platform() == "win32" ? opendir + "\\" + id + ".json" : dir + "/" + id + ".json"
27 | let settingspath = os.platform() == "win32" ? opendir + "\\" + "settings.json" : dir + "/" + "settings.json"
28 | let options = JSON.parse(fs.readFileSync(fullpath, 'utf8'))
29 | let settings = JSON.parse(fs.readFileSync(settingspath, 'utf8'))
30 | let activity = {}
31 | let assets = {}
32 |
33 | if (options.largeimage !== '') {
34 | activity.largeImageKey = options.largeimage
35 | // If you change this and some asks about this, please still give me credit :)
36 | activity.largeImageText = "Made with ThatOneCalculator's Discord RPC Maker (v2.0.9 CLI)!"
37 | }
38 | if (options.smallimage !== '') {
39 | activity.smallImageKey = options.smallimage
40 | // Same applies with assets.large_text
41 | activity.smallImageText = 'https://drpcm.t1c.dev/'
42 | }
43 | if (assets !== {}) { activity.assets = assets }
44 | if (options.description !== '') { activity.details = options.description }
45 | if (options.state !== '') { activity.state = options.state }
46 | if (options.buttons.length !== 0) { activity.buttons = options.buttons }
47 |
48 | if (settings.showtimestamp == true) {
49 | activity.startTimestamp = Date.now()
50 | }
51 |
52 | function assembleClient(timeout = 5000) {
53 | client.destroy()
54 | client = new RPC.Client({ transport: 'ipc' })
55 | client.on('ready', () => {
56 | running = true;
57 | client.setActivity(activity);
58 | client.transport.socket.on("close", (c, s) => {
59 | assembleClient()
60 | })
61 | })
62 | setTimeout(() => client.login({ clientId: options.clientid }), timeout)
63 | }
64 |
65 | process.on("unhandledRejection", e => {
66 | if (e.message === "Could not connect") {
67 | console.log("Crashed! Retrying...")
68 | assembleClient()
69 | }
70 | })
71 |
72 | assembleClient(1000)
73 |
74 | console.log("Started!")
75 | }
76 |
77 | else {
78 | function createWindow() {
79 | win = new BrowserWindow({
80 | width: 1200,
81 | height: 700,
82 | minWidth: 900,
83 | minHeight: 600,
84 | webPreferences: {
85 | contextIsolation: true,
86 | nodeIntegration: true,
87 | enableRemoteModule: true,
88 | preload: path.join(__dirname, "preload.js"),
89 | icon: iconpath
90 | }
91 | })
92 |
93 | let settings = {}
94 |
95 | if (!fs.existsSync(dir)) {
96 | initialdata = {
97 | launchedpresence: false,
98 | language: "english",
99 | theme: "dark",
100 | quitonx: false,
101 | showtimestamp: false
102 | }
103 | if (os.platform() == "win32") {
104 | fs.mkdirSync(opendir, { recursive: true })
105 | }
106 | else {
107 | fs.mkdirSync(dir, { recursive: true })
108 | }
109 | fs.copyFileSync(`${path.join(__dirname, `${slash}themes${slash}dark.css`)}`, `${dir}${slash}custom.css`)
110 | fs.writeFile(`${dir}${slash}settings.json`, JSON.stringify(initialdata, null, 2), 'utf8', (err) => {
111 | if (err) { throw err }
112 | else { console.log("First launch") }
113 | })
114 | //welcome message
115 | const msg = {
116 | type: 'question',
117 | buttons: [],
118 | defaultId: 0,
119 | title: 'Welcome',
120 | message: 'Thank you for choosing Discord RPC Maker!',
121 | detail: 'If you need instructions, click the question (?) icon in the bottom right.',
122 | };
123 | dialog.showMessageBox(null, msg)
124 | }
125 |
126 |
127 | try {
128 |
129 | let settingspath = os.platform() == "win32" ? opendir + "\\" + "settings.json" : dir + "/" + "settings.json"
130 | settings = JSON.parse(fs.readFileSync(settingspath, 'utf8'))
131 | }
132 | catch (e) {
133 | console.log(e)
134 | fs.mkdirSync(dir, { recursive: true })
135 | settings = {
136 | launchedpresence: false,
137 | language: "english",
138 | theme: "dark",
139 | quitonx: false,
140 | showtimestamp: false
141 | }
142 | fs.writeFileSync(`${dir}${slash}settings.json`, JSON.stringify(settings, null, 2), 'utf8', (err) => {
143 | if (err) { throw err }
144 | else { console.log("Wrote base settings") }
145 | })
146 | }
147 | if (settings['quitonx'] == false) {
148 | win.on('minimize', function (event) {
149 | event.preventDefault();
150 | win.hide();
151 | })
152 |
153 | win.on('close', function (event) {
154 | if (!app.isQuiting) {
155 | event.preventDefault();
156 | win.hide();
157 | }
158 |
159 | return false;
160 | })
161 | }
162 | win.setIcon(iconpath)
163 | //win.setResizable(false);
164 | const menu = Menu()
165 | win.setMenuBarVisibility(false)
166 |
167 | //start loading screen
168 | win.loadFile("loading.html")
169 |
170 | loadingEvents.on('finished', () => {
171 | win.loadFile('index.html')
172 | })
173 |
174 | //load for one second, then do an internet check
175 | setTimeout(() => {
176 | require('dns').resolve("https://drpcm.t1c.dev", function (err) {
177 | if (err) {
178 | noInternet(win)
179 | } else {
180 | setTimeout(() => loadingEvents.emit('finished'), 250)
181 | }
182 | })
183 | }, 150)
184 |
185 | function noInternet() {
186 | require('dns').resolve("https://drpcm.t1c.dev", function (err) {
187 | if (err) {
188 | win.webContents.send("no-internet")
189 | console.log("sending no internet")
190 | setTimeout(noInternet, 5000)
191 | } else {
192 | //when we connect just stop loading
193 | loadingEvents.emit('finished')
194 | }
195 | })
196 | }
197 | app.on('window-all-closed', () => {
198 | if (process.platform !== 'darwin') {
199 | app.quit();
200 | }
201 | })
202 | app.on('before-quit', () => {
203 | win.removeAllListeners('close');
204 | win.close();
205 | })
206 | }
207 |
208 |
209 |
210 | const gotTheLock = app.requestSingleInstanceLock()
211 |
212 | if (!gotTheLock) {
213 | app.quit()
214 | }
215 | else {
216 | app.on('second-instance', (event, commandLine, workingDirectory) => {
217 | // Someone tried to run a second instance, we should focus our window.
218 | if (win) {
219 | if (win.isMinimized()) win.restore()
220 | win.focus()
221 | win.show()
222 | }
223 | })
224 |
225 | // Create myWindow, load the rest of the app, etc...
226 | app.whenReady().then(() => {
227 | createWindow()
228 | win = BrowserWindow.getAllWindows()[0]
229 | if (os.platform() == "darwin") {
230 | appIcon = new Tray(path.join(__dirname, "/assets/iconTemplate.png"))
231 | }
232 | else {
233 | appIcon = new Tray(iconpath)
234 | }
235 | const contextMenu = new Menu()
236 | contextMenu.append(new MenuItem({
237 | label: 'Show Discord RPC Maker',
238 | click: () => { app.isquitting = true; win.show() }
239 | }))
240 | contextMenu.append(new MenuItem({
241 | label: 'Quit Discord RPC Maker',
242 | click: () => { app.quit() }
243 | }))
244 | appIcon.setContextMenu(contextMenu)
245 | appIcon.setToolTip("Discord RPC Maker")
246 | })
247 | }
248 |
249 |
250 | app.on("activate", () => {
251 | if (BrowserWindow.getAllWindows().length === 0) {
252 | createWindow()
253 | }
254 | })
255 | }
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Discord RPC Maker
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
247 |
248 |
249 |
250 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/preload.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs')
2 | const os = require('os')
3 | const path = require('path')
4 | const RPC = require('discord-rpc')
5 | const openExplorer = require('open-file-explorer')
6 | // const keytar = require('keytar')
7 | const { ipcRenderer } = require('electron')
8 | const { dialog, shell, BrowserWindow } = require('@electron/remote')
9 | const execSync = require('child_process').execSync
10 |
11 | const slash = os.platform() == 'win32' ? "\\" : "/"
12 |
13 | const dir = `${os.userInfo().homedir}/${process.platform === 'win32' ? '/AppData/Roaming/drpcm/' : '/.config/drpcm/'}`
14 | const opendir = dir.replaceAll("/", "\\").replaceAll("\\\\", "\\")
15 | const settingspath = os.platform() == "win32" ? opendir + "\\" + "settings.json" : dir + "/" + "settings.json"
16 | let settings = JSON.parse(fs.readFileSync(settingspath, 'utf8'))
17 | let theme = settings["theme"]
18 |
19 | let clientID = 0
20 | let options = {}
21 | let client = new RPC.Client({ transport: 'ipc' })
22 |
23 | let inputs = []
24 | let selects = []
25 |
26 | let activity = {}
27 | let assets = {}
28 |
29 | //check for appdata / .config dir and make it if it doesen't exist
30 | if (!fs.existsSync(dir)) {
31 | initialdata = {
32 | launchedpresence: false,
33 | language: "english",
34 | theme: "dark",
35 | quitonx: false,
36 | showtimestamp: false
37 | }
38 | fs.mkdirSync(dir, { recursive: true })
39 | fs.copyFileSync(`${path.join(__dirname, `${slash}themes${slash}dark.css`)}`, `${dir}${slash}custom.css`)
40 | fs.writeFile(`${dir}${slash}settings.json`, JSON.stringify(initialdata, null, 2), 'utf8', (err) => {
41 | if (err) { throw err }
42 | else { console.log("First launch") }
43 | })
44 | //welcom emessage
45 | const msg = {
46 | type: 'question',
47 | buttons: [],
48 | defaultId: 0,
49 | title: 'Welcome',
50 | message: 'Thank you for choosing Discord RPC Maker!',
51 | detail: 'If you need instructions, click the question (?) icon in the bottom right.',
52 | };
53 | dialog.showMessageBox(null, msg)
54 | }
55 |
56 | //esc to exit out of faq and settings
57 | window.addEventListener("keydown", (event) => {
58 | if (event.key !== "Escape") { return }
59 | try {
60 | closeFaqModal()
61 | closeSettingsModal()
62 | } catch (e) { }
63 |
64 | console.log(event);
65 | });
66 |
67 | //make the border red if url validation fails
68 | function updateValidButton(button, elem) {
69 | url = elem.value
70 | isValid = validateurl(url)
71 |
72 | if (isValid) {
73 | button.classList.remove("danger")
74 | elem.classList.add("input-success")
75 | } else {
76 | elem.classList.remove("input-success")
77 | button.classList.add("danger")
78 | }
79 | }
80 |
81 | //save presence as json
82 | function saveAsJson() {
83 | let presencename = document.getElementById("presence-name-input").value.toString()
84 | if (presencename.length == 0) {
85 | const msg = {
86 | type: 'error',
87 | title: 'Error',
88 | message: 'You need to have a title.',
89 | }
90 | dialog.showMessageBox(null, msg)
91 | document.getElementById("test").setAttribute("disabled", "true")
92 | return
93 | }
94 | let presenceid = document.getElementById("presence-id").value.toString()
95 |
96 | let description = document.getElementById("description-input-1").value.toString()
97 | if (description.length == 1) { description += "_" }
98 | let state = document.getElementById("description-input-2").value.toString()
99 | if (state.length == 1) { state += "_" }
100 | let largeimage = document.getElementById("large-image-input").value.toString()
101 | let smallimage = document.getElementById("small-image-input").value.toString()
102 | largeimage = largeimage == "None" ? "" : largeimage
103 | smallimage = smallimage == "None" ? "" : smallimage
104 | let buttononelabel = document.getElementById("button1-input-name").value.toString()
105 | let buttononeurl = document.getElementById("button1-input-url").value.toString()
106 | if (!buttononeurl.startsWith('http')) { buttononeurl = 'https://' + buttononeurl }
107 | let buttontwolabel = document.getElementById("button2-input-name").value.toString()
108 | let buttontwourl = document.getElementById("button2-input-url").value.toString()
109 | if (!buttontwourl.startsWith('http')) { buttontwourl = 'https://' + buttontwourl }
110 | buttonone = { label: buttononelabel, url: buttononeurl }
111 | buttontwo = { label: buttontwolabel, url: buttontwourl }
112 | const buttons = []
113 | if (document.getElementById("button1-enable").checked && validateurl(buttononeurl)) { buttons.push(buttonone) }
114 | if (document.getElementById("button2-enable").checked && validateurl(buttontwourl)) { buttons.push(buttontwo) }
115 | const content = {
116 | name: presencename,
117 | clientid: clientID,
118 | description: description,
119 | state: state,
120 | largeimage: largeimage,
121 | smallimage: smallimage,
122 | buttons: buttons
123 | }
124 |
125 | const data = JSON.stringify(content, null, 2)
126 | let filename = presenceid == "" ? generateId(10) : presenceid
127 | fs.writeFileSync(`${dir}${slash}${filename}.json`, data, 'utf8', (err) => {
128 | if (err) { throw err }
129 | else { console.log("saved") }
130 | })
131 | return filename
132 | }
133 |
134 | //fetch discord for images, fill in selects and enable inputs
135 | async function bootClientId(presence, ready) {
136 | //checks what is in clientid input
137 | let inp = document.querySelector(".client-id-enabler")
138 | let enableOnClientid = document.querySelectorAll(".enable-on-clientid")
139 | enableOnClientid.forEach((item, i, arr) => {
140 | item.disabled = true;
141 | })
142 | document.getElementById("large-image-div").classList.add("customdisabled")
143 | document.getElementById("small-image-div").classList.add("customdisabled")
144 |
145 | let button1enable = document.getElementById("button1-enable")
146 | let button2enable = document.getElementById("button2-enable")
147 | let btn1label = document.getElementById("button1-input-name")
148 | let btn1url = document.getElementById("button1-input-url")
149 | let btn2label = document.getElementById("button2-input-name")
150 | let btn2url = document.getElementById("button2-input-url")
151 |
152 | btn1label.value = ""
153 | btn2label.value = ""
154 | btn1url.value = ""
155 | btn2url.value = ""
156 | if (button1enable.checked) { button1enable.click() }
157 | document.getElementById("small-image").src = "assets/blank.png"
158 |
159 | //checks if clientid input has a valid clientid (long enough, only numbers)
160 | if (presence.addDanger == true) {
161 | inp.classList.remove("input-success")
162 | inp.classList.add("input-danger")
163 | }
164 | if (inp.value !== "" && inp.value.toString().length > 17 && isNaN(parseInt(inp.value)) == false) {
165 | //call discord api to make sure clientid is valid
166 | let response = await fetch(`https://discord.com/api/oauth2/applications/${inp.value.toString()}/assets`)
167 | if (response.ok) {
168 | //client id is valid, enable inputs
169 | options = await fetch(`https://discord.com/api/oauth2/applications/${inp.value.toString()}/assets`).then(options => options.json())
170 | clientID = inp.value//get clientid and store it
171 |
172 | console.log(options)
173 |
174 | //enable everything on valid clientid
175 | enableOnClientid.forEach((item, i, arr) => {
176 | item.removeAttribute("disabled")
177 | })
178 | document.getElementById("large-image-div").classList.remove("customdisabled")
179 | document.getElementById("small-image-div").classList.remove("customdisabled")
180 |
181 | //populate the image select options with fetched names of images from the discord api
182 | imageinputs = document.querySelectorAll("#large-image-input, #small-image-input")
183 | imageinputs.forEach((item, i, arr) => {
184 | htmll = ''
185 | htmll += item == document.getElementById('large-image-input') ? '' : ''
186 | htmll += ''
187 | options.forEach((opt, index, array) => {
188 | htmll += ``
189 | })
190 | item.innerHTML = htmll
191 | })
192 |
193 | //if we are loading a presence
194 | console.log("loading: ", presence)
195 | if (Object.keys(presence).length > 0) {
196 | //console.log("loading: ", presence)
197 |
198 | let largeimg = document.getElementById("large-image-input")
199 | let smallimg = document.getElementById("small-image-input")
200 | let desc1 = document.getElementById("description-input-1")
201 | let desc2 = document.getElementById("description-input-2")
202 |
203 |
204 | //fill in the values from provided presence, and simulate user clicking / typing in the inputs, so the preview updates.
205 | largeimg.querySelectorAll("option").forEach(opt => {
206 | if (opt.getAttribute("selected") == "selected") {
207 | opt.removeAttribute("selected")
208 | }
209 | })
210 | largeimg.querySelectorAll("option").forEach(opt => {
211 | if (opt.innerText == presence.largeimage) {
212 | opt.setAttribute("selected", "selected")
213 | }
214 | })
215 | largeimg.dispatchEvent(new Event("change"))
216 |
217 | smallimg.querySelectorAll("option").forEach(opt => {
218 | if (opt.getAttribute("selected") == "selected") {
219 | opt.removeAttribute("selected")
220 | }
221 | })
222 | smallimg.querySelectorAll("option").forEach(opt => {
223 | if (opt.innerText == presence.smallimage) {
224 | opt.setAttribute("selected", "selected")
225 | }
226 | })
227 | smallimg.dispatchEvent(new Event("change"))
228 |
229 | desc1.value = presence.description
230 | desc2.value = presence.state
231 |
232 | desc1.dispatchEvent(new Event("input"))
233 | desc2.dispatchEvent(new Event("input"))
234 |
235 | if (presence.buttons.length > 0) {
236 | if (presence.buttons.length == 2) {
237 | button1enable.checked = false;
238 | button2enable.checked = false;
239 | button1enable.click()
240 | button2enable.click()
241 |
242 | btn1label.value = presence.buttons[0].label
243 | btn1url.value = presence.buttons[0].url
244 |
245 | btn2label.value = presence.buttons[1].label
246 | btn2url.value = presence.buttons[1].url
247 |
248 | } else if (presence.buttons.length == 1) {
249 | button1enable.checked = false;
250 | button1enable.click()
251 |
252 | btn1label.value = presence.buttons[0].label
253 | btn1url.value = presence.buttons[0].url
254 | }
255 | btn1label.dispatchEvent(new Event("input"))
256 | btn2label.dispatchEvent(new Event("input"))
257 | btn1url.dispatchEvent(new Event("input"))
258 | btn2url.dispatchEvent(new Event("input"))
259 | }
260 |
261 | }
262 | inp.classList.remove("input-danger")
263 | inp.classList.add("input-success")
264 | } else {
265 | inp.classList.remove("input-success")
266 | inp.classList.add("input-danger")
267 | }
268 | }
269 | if (ready == true) {
270 | document.getElementById("test").removeAttribute("disabled")
271 | }
272 | }
273 |
274 | //load a presence - celar al inputs
275 | function loadPresence(presence, file) {
276 | document.getElementById("presence-id").value = file.replaceAll(".json", "")
277 | document.getElementById("presence-name-input").value = presence.name
278 | document.getElementById("clientid-input").value = presence.clientid
279 | document.getElementById("del-btn").removeAttribute("disabled")
280 | document.getElementById("file-btn").removeAttribute("disabled")
281 | try { bootClientId(presence, true) } catch (e) { }
282 | }
283 |
284 | //what to do when dom loads
285 | document.addEventListener("DOMContentLoaded", () => {
286 | if (document.getElementById("no-internet-msg") != null) {
287 | console.log("waiting for no internet")
288 | ipcRenderer.on('no-internet', (event, arg) => {
289 | document.getElementById("no-internet-msg").style.display = "block"
290 | });
291 | }
292 |
293 | console.log("loaded")
294 |
295 | // Check for updates
296 | function checkForUpdates() {
297 | let run = false
298 |
299 | const latestVersion = require('latest-version');
300 |
301 | (async () => {
302 | const ver = await latestVersion('discordrpcmaker')
303 | console.log(ver)
304 | if (ver != '2.0.9' && !run) {
305 | const msg = {
306 | type: 'question',
307 | buttons: ['No thanks', 'Update!'],
308 | defaultId: 1,
309 | title: 'Update',
310 | message: 'An update is avaliable! Please follow the link to redownload this program.',
311 | }
312 | dialog.showMessageBox(null, msg).then(result => {
313 | if (result.response == 1) {
314 | shell.openExternal('https://drpcm.t1c.dev/#install')
315 | }
316 | })
317 | run = true
318 | return;
319 | }
320 | })()
321 | }
322 |
323 | checkForUpdates()
324 |
325 | //load presences
326 | loadSavedPresences()
327 |
328 | //for testing
329 | // loadLang("german")
330 |
331 | inputs = [
332 | document.getElementById("clientid-input"),
333 | document.getElementById("presence-name-input"),
334 | /*document.getElementById("large-image-input"),
335 | document.getElementById("small-image-input"),*/
336 | document.getElementById("description-input-1"),
337 | document.getElementById("description-input-2"),
338 | document.getElementById("presence-id"),
339 | document.getElementById("small-image-input")
340 | ]
341 |
342 | setTimeout(() => { document.getElementById("fader").style.opacity = "0" }, 250)
343 | setTimeout(() => { document.getElementById("fader").remove() }, 500)
344 |
345 | settings = JSON.parse(fs.readFileSync(settingspath, 'utf8'))
346 | theme = settings["theme"]
347 | if (theme == "pywal") {
348 | let themedir = path.join(__dirname, `${slash}themes${slash}${theme}.css`)
349 | pywalcss = fs.readFileSync(themedir, 'utf8').replaceAll("HOMEDIR", os.homedir)
350 | addStyle(pywalcss)
351 | }
352 | else if (theme == "custom") {
353 | addStyle(fs.readFileSync(`${dir}${slash}custom.css`, 'utf8'))
354 | }
355 | else {
356 | let themedir = path.join(__dirname, `${slash}themes${slash}${theme}.css`)
357 | addStyle(fs.readFileSync(themedir, 'utf8'))
358 | }
359 |
360 | if (os.platform() != "win32") {
361 | try {
362 | const output = execSync('which wal', { encoding: 'utf-8' }).toLowerCase()
363 | if (!output.indexOf("not found") >= 0) {
364 | document.getElementById("pywaloption").removeAttribute("hidden")
365 | }
366 | }
367 | catch (e) { }
368 | }
369 |
370 | //stop presence of
371 | document.getElementById("stop").addEventListener("click", () => {
372 | client.destroy()
373 | document.getElementById("stop").setAttribute("hidden", "true")
374 | document.getElementById("test").setAttribute("class", "btn primary enable-on-clientid mr")
375 | document.getElementById("pfp").setAttribute("src", "assets/wumpsearch.gif")
376 | })
377 | //launch presence
378 | document.getElementById("test").addEventListener("click", () => {
379 | client.destroy()
380 |
381 | id = document.getElementById("presence-id").value
382 | fullpath = os.platform() == "win32" ? opendir + "\\" + id + ".json" : dir + "/" + id + ".json"
383 | options = JSON.parse(fs.readFileSync(fullpath, 'utf8'))
384 | settings = JSON.parse(fs.readFileSync(settingspath, 'utf8'))
385 | activity = {}
386 | assets = {}
387 |
388 | if (options.largeimage !== '') {
389 | activity.largeImageKey = options.largeimage
390 | // If you change this and some asks about this, please still give me credit :)
391 | activity.largeImageText = "Made with ThatOneCalculator's Discord RPC Maker (v2.0)!"
392 | }
393 | if (options.smallimage !== '') {
394 | activity.smallImageKey = options.smallimage
395 | // Same applies with assets.large_text
396 | activity.smallImageText = 'https://drpcm.t1c.dev/'
397 | }
398 | if (assets !== {}) { activity.assets = assets }
399 | if (options.description !== '') { activity.details = options.description }
400 | if (options.state !== '') { activity.state = options.state }
401 | if (options.buttons.length !== 0) { activity.buttons = options.buttons }
402 |
403 |
404 | settings = JSON.parse(fs.readFileSync(settingspath, 'utf8'))
405 | if (settings.showtimestamp == true) {
406 | activity.startTimestamp = Date.now()
407 | }
408 |
409 | function assembleClient(timeout = 5000) {
410 | console.log(options)
411 | client.destroy()
412 | client = new RPC.Client({ transport: 'ipc' })
413 | client.on('ready', () => {
414 | running = true;
415 | client.setActivity(activity);
416 | client.transport.socket.on("close", (c, s) => {
417 | assembleClient()
418 | })
419 | })
420 | setTimeout(() => client.login({ clientId: options.clientid }), timeout)
421 | }
422 |
423 | process.on("unhandledRejection", e => {
424 | if (e.message === "Could not connect") {
425 | assembleClient()
426 | }
427 | })
428 |
429 | assembleClient(1000)
430 |
431 | /*const myNotification = new Notification("Discord RPC Maker", {
432 | body: "Your presence has started.",
433 | icon: "assets/icon.png",
434 | timeoutType: "default",
435 | })*/
436 | console.log("started")
437 | document.getElementById("stop").removeAttribute("hidden")
438 | document.getElementById("pfp").setAttribute("src", "assets/wumpus.gif")
439 | document.getElementById("test").setAttribute("class", "btn success enable-on-clientid mr")
440 | if (settings.launchedpresence == false) {
441 | settings.launchedpresence = true
442 | fs.writeFile(`${dir}${slash}settings.json`, JSON.stringify(settings, null, 2), 'utf8', (err) => {
443 | if (err) { throw err }
444 | else {
445 | const msg = {
446 | type: 'question',
447 | buttons: ['Close', 'Star on GitHub', 'Join the Discord', 'Donate'],
448 | defaultId: 0,
449 | title: 'Welcome',
450 | message: 'Congrats, you launched your first presence!',
451 | detail: 'Don\'t worry, this is the last time you\'ll see this. This project is and always will be free and open source. If you want to show your support, please consider donating, leaving a star on the GitHub, and/or joining the Discord server.',
452 | };
453 | dialog.showMessageBox(null, msg).then(result => {
454 | if (result.response == 1) {
455 | shell.openExternal('https://github.com/thatonecalculator/discordrpcmaker')
456 | }
457 | if (result.response == 2) {
458 | shell.openExternal('https://discord.com/invite/Z7UZPR3bbW')
459 | }
460 | if (result.response == 3) {
461 | shell.openExternal('https://buymeacoffee.com/that1calculator')
462 | }
463 | })
464 | }
465 | })
466 | }
467 |
468 | });
469 |
470 | document.getElementById("themedropdown").addEventListener("change", function () {
471 | let e = document.getElementById("themedropdown")
472 | let selected = e.options[e.selectedIndex].text
473 |
474 |
475 | settings = JSON.parse(fs.readFileSync(settingspath, 'utf8'))
476 | theme = "dark"
477 | theme = selected.toLowerCase().replaceAll(" ", "").replaceAll("é", "e")
478 | if (theme == "pywal") {
479 | let themedir = path.join(__dirname, `${slash}themes${slash}${theme}.css`)
480 | pywalcss = fs.readFileSync(themedir, 'utf8').replaceAll("HOMEDIR", os.homedir)
481 | console.log(pywalcss)
482 | addStyle(pywalcss)
483 | }
484 | else if (theme == "custom") {
485 | addStyle(fs.readFileSync(`${dir}${slash}custom.css`, 'utf8'))
486 | }
487 | else {
488 | let themedir = path.join(__dirname, `${slash}themes${slash}${theme}.css`)
489 | addStyle(fs.readFileSync(themedir, 'utf8'))
490 | }
491 | settings.theme = theme
492 | console.log(settings)
493 | fs.writeFile(`${dir}${slash}settings.json`, JSON.stringify(settings, null, 2), 'utf8', (err) => {
494 | if (err) { throw err }
495 | else { }
496 | })
497 | });
498 |
499 |
500 | document.getElementById("new-presence-button").addEventListener("click", () => {
501 | let empty = {
502 | buttons: [],
503 | clientid: "",
504 | description: "",
505 | largeimage: "",
506 | smallimage: "",
507 | name: "",
508 | state: "",
509 | addDanger: true
510 | }
511 | inputs.forEach((input) => {
512 | input.value = ""
513 | input.dispatchEvent(new Event("input"))
514 | })
515 | document.getElementById("large-image-input").innerHTML = `
516 |
517 |
518 | `
519 | document.getElementById("small-image-input").innerHTML = `
520 |
521 |
522 | `
523 |
524 | document.getElementById("small-image-input").setAttribute("disabled", "true")
525 | document.getElementById("del-btn").setAttribute("disabled", "true")
526 | document.querySelector(".preview-pfp").setAttribute("src", "assets/wumpsearch.gif")
527 | document.getElementById("large-image").setAttribute("src", "assets/placeholder.png")
528 |
529 | // document.getElementById("file-btn").setAttribute("disabled", "true")
530 | bootClientId(empty, false)
531 | });
532 |
533 | //save presence
534 | function savePresence() {
535 | filename = saveAsJson()
536 | reloadPresences()
537 | //document.getElementById("new-presence-button").click()
538 | document.getElementById("del-btn").removeAttribute("disabled")
539 | // document.getElementById("file-btn").removeAttribute("disabled")
540 | document.getElementById("presence-id").value = filename
541 | document.getElementById("test").removeAttribute("disabled")
542 | }
543 |
544 | document.getElementById("save").addEventListener("click", () => {
545 | savePresence()
546 | setTimeout(() => { document.getElementById("test").removeAttribute("disabled") }, 2000)
547 | });
548 |
549 | document.getElementById("del-btn").addEventListener("click", () => {
550 | const options = {
551 | type: 'question',
552 | buttons: ['Cancel', 'Delete'],
553 | defaultId: 0,
554 | title: 'Delete presence',
555 | message: 'Are you sure you want to delete this presence?',
556 | detail: 'This cannot be undone.',
557 | };
558 | dialog.showMessageBox(null, options).then(result => {
559 | if (result.response == 1) { //delete the presence
560 |
561 | let id = document.getElementById("presence-id").value
562 | let fullpath = os.platform() == "win32" ? opendir + "\\" + id + ".json" : dir + "/" + id + ".json"
563 |
564 | //delete the file
565 | fs.stat(fullpath, function (err, stat) {
566 | if (err == null) { //get if it exists
567 | console.log(`${id}.json exists`);
568 | fs.unlink(fullpath, (err) => {
569 | if (err) { throw err; }
570 | console.log("File is deleted."); //log that we deleted it
571 | reloadPresences(); //reload the presences
572 | const myNotification = new Notification("Discord RPC Maker", { //throw a notification
573 | body: `'${document.getElementById("presence-name-input").value}' has been deleted.`,
574 | icon: "assets/icon.png",
575 | timeoutType: "default",
576 | })
577 | document.getElementById("new-presence-button").click() //clear all inputs
578 | });
579 |
580 | } else if (err.code === 'ENOENT') { //if it doesen't exist then don't delete it lul
581 | console.log(`${id}.json doesen't exist, nothing deleted.`)
582 | } else {
583 | alert('error while trying to delete file: ', err.code);
584 | }
585 |
586 | });
587 | }
588 | }).catch(err => {
589 | console.log("error while trying to create message box: " + err)
590 | })
591 | })
592 |
593 | document.getElementById("file-btn").addEventListener("click", () => {
594 |
595 | if (process.platform !== "win32") { openExplorer(dir) }
596 | else { openExplorer(opendir) }
597 | })
598 |
599 | //Easter eggs
600 |
601 | //enable inputs
602 | document.querySelector(".client-id-enabler").addEventListener("input", () => { bootClientId({}, false) })
603 |
604 | document.getElementById("quitonclose-btn")
605 |
606 | settings = JSON.parse(fs.readFileSync(settingspath, 'utf8'))
607 | if (settings.quitonx) { document.getElementById("quitonclose-btn").click() }
608 | if (settings.showtimestamp) { document.getElementById("showtimestamp-btn").click() }
609 |
610 | document.getElementById("quitonclose-btn").addEventListener("change", () => {
611 |
612 | settings = JSON.parse(fs.readFileSync(settingspath, 'utf8'))
613 | settings.quitonx = !settings['quitonx']
614 | fs.writeFile(`${dir}${slash}settings.json`, JSON.stringify(settings, null, 2), 'utf8', (err) => {
615 | if (err) { throw err }
616 | else { }
617 | })
618 | const msg = {
619 | type: 'question',
620 | buttons: [],
621 | defaultId: 0,
622 | title: 'Notice',
623 | message: 'This setting will take affect next launch.',
624 | }
625 | dialog.showMessageBox(null, msg)
626 | })
627 |
628 | document.getElementById("showtimestamp-btn").addEventListener("change", () => {
629 | settings = JSON.parse(fs.readFileSync(settingspath, 'utf8'))
630 | settings.showtimestamp = !settings['showtimestamp']
631 | fs.writeFile(`${dir}${slash}settings.json`, JSON.stringify(settings, null, 2), 'utf8', (err) => {
632 | if (err) { throw err }
633 | else { }
634 | })
635 | const msg = {
636 | type: 'question',
637 | buttons: [],
638 | defaultId: 0,
639 | title: 'Notice',
640 | message: 'This setting will take affect the next time you click the Launch Presence button.',
641 | }
642 | dialog.showMessageBox(null, msg)
643 | })
644 |
645 | //button enabling
646 | //enabling of first button
647 | document.getElementById("button1-enable").addEventListener("change", () => {
648 | notReady()
649 | if (document.getElementById("button1-enable").checked) {
650 | //enable all buttons
651 | inps = document.querySelector(".button1")
652 | inps.querySelectorAll('input[disabled]').forEach((item, i, arr) => {
653 | item.removeAttribute("disabled");
654 | });
655 |
656 | document.getElementById('button2-enable').removeAttribute('disabled')
657 | document.getElementById("preview-button-1").classList.remove("initially-hidden")
658 | document.getElementById("button1-input-name").addEventListener("input", () => { updatePreview("btn1name") })
659 | document.getElementById("button1-input-url").addEventListener("input", () => { updatePreview("btn1url") })
660 | } else {
661 | //disable buttons
662 | inps = document.querySelector(".button1")
663 | inps.querySelectorAll('input[type="text"]').forEach((item, i, arr) => {
664 | item.setAttribute("disabled", "");
665 | });
666 |
667 | button2enable = document.getElementById('button2-enable')
668 | document.getElementById("preview-button-1").classList.add("initially-hidden")
669 | if (button2enable.checked == true) { button2enable.click() }
670 | button2enable.disabled = true;
671 |
672 | try {
673 | //remove listeners for both buttons
674 | document.getElementById("button1-input-name").removeEventListener("input", () => { updatePreview("btn1name") })
675 | document.getElementById("button1-input-url").removeEventListener("input", () => { updatePreview("btn1url") })
676 | document.getElementById("button2-input-name").removeEventListener("input", () => { updatePreview("btn2name") })
677 | document.getElementById("button2-input-url").removeEventListener("input", () => { updatePreview("btn2url") })
678 | } catch (e) { }
679 | }
680 | });
681 | //enabling of second button
682 | document.getElementById("button2-enable").addEventListener("change", () => {
683 | notReady()
684 | if (document.getElementById("button2-enable").checked) {
685 | //enable second button
686 | inps = document.querySelector(".button2")
687 | inps.querySelectorAll('input:disabled').forEach((item, i, arr) => {
688 | item.removeAttribute("disabled");
689 | });
690 | document.getElementById("preview-button-2").classList.remove("initially-hidden")
691 | document.getElementById("button2-input-name").addEventListener("input", () => { updatePreview("btn2name") })
692 | document.getElementById("button2-input-url").addEventListener("input", () => { updatePreview("btn2url") })
693 | } else {
694 | inps = document.querySelector(".button2")
695 | //disable second button
696 | inps.querySelectorAll('input[type="text"]').forEach((item, i, arr) => {
697 | item.setAttribute("disabled", "");
698 | });
699 | document.getElementById("preview-button-2").classList.add("initially-hidden")
700 | document.getElementById("button2-input-name").removeEventListener("input", () => { updatePreview("btn2name") })
701 | document.getElementById("button2-input-url").removeEventListener("input", () => { updatePreview("btn2url") })
702 | }
703 | });
704 |
705 | //description line 1 updating
706 | document.getElementById("description-input-1").addEventListener("input", () => {
707 | updatePreview("desc1")
708 | });
709 |
710 | //description line 2 updating
711 | document.getElementById("description-input-2").addEventListener("input", () => {
712 | updatePreview("desc2")
713 | });
714 |
715 | //updating of the large image
716 | document.getElementById("large-image-input").addEventListener("change", () => {
717 | updatePreview("largeimg")
718 | })
719 |
720 | document.getElementById("small-image-input").addEventListener("change", () => {
721 | updatePreview("smallimg")
722 | })
723 |
724 | //fix win outline
725 | if (process.platform === "linux") {
726 | h1 = document.querySelectorAll("h1")
727 | h1.forEach((item, i, arr) => {
728 | item.setAttribute("style", "-webkit-text-stroke-width: 2px")
729 | })
730 | }
731 |
732 | //make links open in new tab
733 | registerLinkToOpenInBrowser("github-button", "https://github.com/ThatOneCalculator/DiscordRPCMaker")
734 | registerLinkToOpenInBrowser("discord-button", "https://discord.com/invite/Z7UZPR3bbW")
735 | registerLinkToOpenInBrowser("web-button", "https://drpcm.t1c.dev")
736 | registerLinkToOpenInBrowser("donate-button", "https://buymeacoffee.com/that1calculator")
737 |
738 | //developer portal
739 | document.getElementById("devel").addEventListener("click", () => {
740 | notReady()
741 | develWindow = new BrowserWindow({
742 | width: 1200,
743 | height: 700,
744 | webPreferences: {
745 | nodeIntegration: true,
746 | preload: `${__dirname}${slash}clientidDetect.js`
747 | }
748 | });
749 | //load html into window
750 | develWindow.loadURL('https://discord.com/developers')
751 | // develWindow.webContents.openDevTools();
752 | //garbage collection handle
753 | develWindow.on('close', function () {
754 | develWindow = null;
755 | });
756 | })
757 |
758 | settings = JSON.parse(fs.readFileSync(settingspath, 'utf8'))
759 | document.querySelector("#faqbody").innerHTML = fs.readFileSync(path.join(__dirname + `${slash}locales${slash}faq${slash}${settings['language']}.html`))
760 | registerLinkToOpenInBrowser("cliutility", "https://github.com/ThatOneCalculator/DiscordRPCMaker-CLI")
761 | registerLinkToOpenInBrowser("t1c", "https://t1c.dev")
762 | registerLinkToOpenInBrowser("kraxen", "https://github.com/KraXen72")
763 | registerLinkToOpenInBrowser("mikey", "https://twitter.com/ChildishMigster")
764 | })
765 |
766 | /*preview updating*/
767 | function updatePreview(type) {
768 | notReady()
769 | //images
770 | let smallimage = document.getElementById("small-image-input")
771 | let largeimage = document.getElementById("large-image-input")
772 | let smallimageprev = document.getElementById("small-image")
773 | let largeimageprev = document.getElementById("large-image")
774 | //description
775 | let desc1 = document.getElementById("description-input-1")
776 | let desc2 = document.getElementById("description-input-2")
777 | //buttons
778 | let btn1name = document.getElementById("button1-input-name")
779 | let btn1url = document.getElementById("button1-input-url")
780 | let btn2name = document.getElementById("button2-input-name")
781 | let btn2url = document.getElementById("button2-input-url")
782 |
783 | if (type == "largeimg") { //large - if image from id not found, just put placeholder there
784 | let imgid = getImageIdFromName(largeimage.value)
785 | console.log(imgid)
786 | if (imgid == "") {
787 | largeimageprev.setAttribute("src", "assets/placeholder.png")
788 | document.getElementById("small-image-input").setAttribute("disabled", "")
789 | document.getElementById("small-image-div").classList.add("customdisabled")
790 | } else {
791 | largeimageprev.setAttribute("src", `https://cdn.discordapp.com/app-assets/${clientID}/${imgid}.png`)
792 | document.getElementById("small-image-input").removeAttribute("disabled")
793 | document.getElementById("small-image-div").classList.remove("customdisabled")
794 | }
795 | } else if (type == "smallimg") { //small - if image from id not found, just put placeholder there
796 | let imgid = getImageIdFromName(smallimage.value)
797 | console.log(imgid)
798 | if (imgid == "") {
799 | smallimageprev.setAttribute("src", "assets/blank.png")
800 | } else {
801 | smallimageprev.setAttribute("src", `https://cdn.discordapp.com/app-assets/${clientID}/${imgid}.png`)
802 | }
803 | } else if (type == "desc1") { //description line 1
804 | document.getElementById("preview-description-1").innerHTML = desc1.value
805 | } else if (type == "desc2") { //description line 2
806 | document.getElementById("preview-description-2").innerHTML = desc2.value
807 | } else if (type == "btn1name") { //button 1 name
808 | document.getElementById("preview-button-1").innerHTML = btn1name.value
809 | } else if (type == "btn1url") {// button 1 url
810 | updateValidButton(document.getElementById("preview-button-1"), btn1url)
811 | } else if (type == "btn2name") { //button 2 name
812 | document.getElementById("preview-button-2").innerHTML = btn2name.value
813 | } else if (type == "btn2url") {// button 2 url
814 | updateValidButton(document.getElementById("preview-button-2"), btn2url)
815 | }
816 | }
817 |
818 | /*utility functions*/
819 |
820 | /**
821 | * register a button to open in the native browser
822 | * @param {String} elemid element id
823 | * @param {String} link the link to go to
824 | */
825 | function registerLinkToOpenInBrowser(elemid, link) {
826 | let elem = document.querySelector(`#${elemid}`)
827 |
828 | elem.addEventListener("click", () => {
829 | shell.openExternal(link)
830 | })
831 |
832 | faqbtn = document.getElementById("faq-button")
833 | faqbtn.addEventListener("click", () => { openFaqModal() })
834 | faqbtn = document.getElementById("closefaqmodal")
835 | faqbtn.addEventListener("click", () => { closeFaqModal() })
836 | settingsbtn = document.getElementById("settings-button")
837 | settingsbtn.addEventListener("click", () => { openSettingsModal() })
838 | settingsbtn = document.getElementById("closesettingsmodal")
839 | settingsbtn.addEventListener("click", () => { closeSettingsModal() })
840 |
841 | }
842 |
843 | //add a style to head - used when loading themes
844 | function addStyle(styleString) {
845 | const style = document.createElement('style');
846 | style.textContent = styleString;
847 | document.head.append(style);
848 | }
849 |
850 | //url validation regex
851 | function validateurl(str) {
852 | const regexp = /^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/
853 |
854 | return regexp.test(str)
855 | }
856 | function dec2hex(dec) {
857 | return dec.toString(16).padStart(2, "0")
858 | }
859 |
860 | function generateId(len) {
861 | let arr = new Uint8Array((len || 40) / 2)
862 | window.crypto.getRandomValues(arr)
863 | return Array.from(arr, dec2hex).join('')
864 | }
865 |
866 | //get the image id from options provided the name
867 | function getImageIdFromName(imgName) {
868 | let matchedid = ""
869 | options.forEach((image, i, arr) => {
870 | if (image.name == imgName) {
871 | matchedid = image.id
872 | }
873 | })
874 | return matchedid
875 | }
876 |
877 | function notReady() {
878 | document.getElementById("test").setAttribute("disabled", "true")
879 | //console.log("not ready")
880 | }
881 |
882 | function removeAllChildNodes(parent) {
883 | while (parent.firstChild) {
884 | parent.removeChild(parent.firstChild);
885 | }
886 | }
887 |
888 | //presences loading and reloading
889 |
890 | function loadSavedPresences() {
891 | let files = fs.readdir(dir, (directory, files) => {
892 | console.log(files)
893 | let wrapper = document.getElementById('presence-scroller')
894 | files.forEach(file => {
895 | console.log(file)
896 | if (file.includes(".json") && file.includes("settings") == false) {
897 | let presence = JSON.parse(fs.readFileSync(dir + file, 'utf8'));
898 | let elem = document.createElement('div')
899 | html = `
900 |