mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
Compare commits
36 commits
2956d8b8a9
...
01f3816190
Author | SHA1 | Date | |
---|---|---|---|
|
01f3816190 | ||
|
c8e6855a02 | ||
|
c933981420 | ||
|
9f9b4deae9 | ||
|
05daca16d4 | ||
|
83b4f75e87 | ||
|
5b509d948f | ||
|
d8fe49df3f | ||
|
0ebaa5627e | ||
|
251f4d55ff | ||
|
a3ac768f25 | ||
|
efe835be04 | ||
|
e946615770 | ||
|
db9bfbb269 | ||
|
56c7b68c47 | ||
|
69012c95a0 | ||
|
7afb3962dc | ||
|
b25ff8dec3 | ||
|
6e30ffa7bf | ||
|
40dc67f0a8 | ||
|
9c2b00d56f | ||
|
d6cbbcba7d | ||
|
1a7af5168d | ||
|
b4f2265efb | ||
|
f272bb822e | ||
|
73c9e8ecb7 | ||
|
927f498872 | ||
|
774a8bea2b | ||
|
1d916df998 | ||
|
161b18a725 | ||
|
46a3f3e17b | ||
|
e59c074230 | ||
|
249619419f | ||
|
c4aba0bc1b | ||
|
0d1e174d60 | ||
|
033e5b7973 |
41 changed files with 509 additions and 322 deletions
32
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
32
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Desktop (please complete the following information):**
|
||||||
|
- OS: [e.g. Linux, Windows, macOS]
|
||||||
|
- Method of installation [e.g. snap, setup exe, aur]
|
||||||
|
- Version [e.g. 3.0.7]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
5
.idea/.gitignore
generated
vendored
Normal file
5
.idea/.gitignore
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
12
.idea/ArmCord.iml
generated
Normal file
12
.idea/ArmCord.iml
generated
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
21
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
21
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="myValues">
|
||||||
|
<value>
|
||||||
|
<list size="7">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="nobr" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="noembed" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="comment" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="noscript" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="embed" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="script" />
|
||||||
|
<item index="6" class="java.lang.String" itemvalue="color" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="myCustomValuesEnabled" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/ArmCord.iml" filepath="$PROJECT_DIR$/.idea/ArmCord.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
49
README.md
49
README.md
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<img src="https://armcord.vercel.app/logo.png" width="520">
|
<img src="https://armcord.xyz/logo.png" width="520">
|
||||||
<br>ArmCord is a custom client designed to enhance your Discord experience while keeping everything lightweight.
|
<br>ArmCord is a custom client designed to enhance your Discord experience while keeping everything lightweight.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -8,27 +8,27 @@
|
||||||
|
|
||||||
- **Standalone client**
|
- **Standalone client**
|
||||||
|
|
||||||
ArmCord is built as standalone client, it doesn't rely on original Discord client.
|
ArmCord is built as a standalone client and doesn't rely on the original Discord client in anyway.
|
||||||
|
|
||||||
|
|
||||||
- **Various mods built in**
|
- **Various mods built in**
|
||||||
|
|
||||||
Explore Cumcord/GooseMod/Flicker plugins and their features!
|
Enjoy Cumcord, GooseMod, Flicker, and their many features, or have a more vanilla experience, it's your choice!
|
||||||
|
|
||||||
|
|
||||||
- **Made for Privacy**
|
- **Made for Privacy™**
|
||||||
|
|
||||||
ArmCord automatically blocks Discord's trackers.
|
ArmCord automatically blocks all of Discord's trackers; even without any client mods you can feel safe and secure!
|
||||||
|
|
||||||
|
|
||||||
- **Faster than normal Discord app**
|
- **Much more stable**
|
||||||
|
|
||||||
ArmCord is using newer Electron than stock Discord app. This usually means increased performance and more stable experience.
|
ArmCord is using a newer build of Electron than the stock Discord app. This means you can have a much more stable and secure experience, along with slightly better performance.
|
||||||
|
|
||||||
|
|
||||||
- **Designed to work anywhere**
|
- **Cross-platform support!**
|
||||||
|
|
||||||
ArmCord was initially created in mind to run on Arm64 Linux devices. We soon expanded our support to more platforms. We plan to support every platform that [Electron supports](https://www.electronjs.org/docs/latest/tutorial/support#supported-platforms).
|
ArmCord was originally created for ARM64 Linux devices, since Discord doesn't support them. We soon decided to support every platform that [Electron supports](https://github.com/electron/electron#platform-support)!
|
||||||
|
|
||||||
# How to run/install it?
|
# How to run/install it?
|
||||||
### Recommended:
|
### Recommended:
|
||||||
|
@ -48,8 +48,10 @@ ArmCord is also available on the Snap store [here](https://snapcraft.io/armcord)
|
||||||
### Pi-Apps
|
### Pi-Apps
|
||||||
ArmCord is also available in [Pi-Apps](https://github.com/Botspot/pi-apps).
|
ArmCord is also available in [Pi-Apps](https://github.com/Botspot/pi-apps).
|
||||||
[](https://github.com/Botspot/pi-apps)
|
[](https://github.com/Botspot/pi-apps)
|
||||||
### Manual:
|
|
||||||
Alternatively you can run ArmCord from source (npm, nodejs required):
|
|
||||||
|
### Compiling:
|
||||||
|
Alternatively you can run ArmCord from source (NodeJS and npm required):
|
||||||
1. Clone ArmCord repo: `git clone https://github.com/ArmCord/ArmCord.git`
|
1. Clone ArmCord repo: `git clone https://github.com/ArmCord/ArmCord.git`
|
||||||
2. Run `npm install` to install dependencies
|
2. Run `npm install` to install dependencies
|
||||||
3. Build with `npm run build`
|
3. Build with `npm run build`
|
||||||
|
@ -57,24 +59,29 @@ ArmCord is also available in [Pi-Apps](https://github.com/Botspot/pi-apps).
|
||||||
|
|
||||||
|
|
||||||
# FAQ
|
# FAQ
|
||||||
## 1. Will I get banned from using it?
|
## Will I get banned for using this?
|
||||||
|
- You are breaking [Discord ToS](https://discord.com/terms#software-in-discord%E2%80%99s-services) by using ArmCord, but no one has been banned from using it or any of the client mods included.
|
||||||
|
|
||||||
- You are breaking Discord ToS if you decided to use client mods. But no one ever got banned from using ArmCord or any of the client mods included. If you wish to remove mods, check our documentation.
|
## Can I use this on anything other than ARM?
|
||||||
## 2. How does this work?
|
- Yes! ArmCord should work normally under Windows, MacOS and Linux as long as it has Electron support.
|
||||||
|
|
||||||
- We are using official web app and adding some magic powder to make it all work!
|
## How does this work?
|
||||||
## 3. Can I use this on other architectures or operating systems?
|
- We are using the official web app and adding some magic powder to make it all work!
|
||||||
|
|
||||||
|
## Where can I find the source code?
|
||||||
|
- The source code is on [GitHub](https://github.com/ArmCord/ArmCord/).
|
||||||
|
|
||||||
|
## Where can I translate this?
|
||||||
|
- Translations are done using our [Weblate page](https://hosted.weblate.org/projects/armcord/armcord/). They're pushed to this [repo](https://github.com/ArmCord/i18n).
|
||||||
|
|
||||||
- Yes! ArmCord should work normally under Windows, Mac OS and Linux as long as it has NodeJS, npm and Electron support.
|
|
||||||
## 4. Where can I translate this?
|
|
||||||
- Translations are done using our [Weblate page](https://hosted.weblate.org/projects/armcord/armcord/). They're pushed to this [repo](https://github.com/ArmCord/i18n).
|
|
||||||
# Credits
|
# Credits
|
||||||
[ArmCord UI Elements and few features](https://github.com/kckarnige)
|
[ArmCord UI design, branding, and a few features](https://github.com/kckarnige)
|
||||||
[Cumcord](https://github.com/Cumcord/Cumcord)
|
[Cumcord](https://github.com/Cumcord/Cumcord)
|
||||||
[GooseMod](https://github.com/GooseMod/GooseMod)
|
[GooseMod](https://github.com/GooseMod/GooseMod)
|
||||||
[GooseMod Extension](https://github.com/GooseMod/extension)
|
[GooseMod Extension](https://github.com/GooseMod/extension)
|
||||||
|
[FlickerMod](https://github.com/FlickerMod)
|
||||||
[electron-discord-webapp](https://github.com/SpacingBat3/electron-discord-webapp)
|
[electron-discord-webapp](https://github.com/SpacingBat3/electron-discord-webapp)
|
||||||
[custom-electron-titlebar (css only)](https://github.com/AlexTorresSk/custom-electron-titlebar)
|
(Pre v3.0.6) [custom-electron-titlebar](https://github.com/AlexTorresSk/custom-electron-titlebar)
|
||||||
[electron-builder](https://electron.build)
|
[electron-builder](https://electron.build)
|
||||||
[OpenAsar](https://github.com/GooseMod/OpenAsar)
|
[OpenAsar](https://github.com/GooseMod/OpenAsar)
|
||||||
# Sponsors
|
# Sponsors
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
"settings-theme-native": "Native",
|
"settings-theme-native": "Native",
|
||||||
"settings-tray": "Minimize to tray",
|
"settings-tray": "Minimize to tray",
|
||||||
"settings-patches": "Automatic Patches",
|
"settings-patches": "Automatic Patches",
|
||||||
|
"settings-mobileMode": "Mobile mode",
|
||||||
"settings-channel": "Discord channel:",
|
"settings-channel": "Discord channel:",
|
||||||
"settings-invitewebsocket": "Invite Websocket",
|
"settings-invitewebsocket": "Invite Websocket",
|
||||||
"settings-mod": "Client mod:",
|
"settings-mod": "Client mod:",
|
||||||
|
@ -25,6 +26,6 @@
|
||||||
"settings-prfmMode-performance": "Performance",
|
"settings-prfmMode-performance": "Performance",
|
||||||
"settings-prfmMode-battery": "Battery",
|
"settings-prfmMode-battery": "Battery",
|
||||||
"settings-none": "None",
|
"settings-none": "None",
|
||||||
"settings-save": "Save settings",
|
"settings-save": "Save Settings",
|
||||||
"settings-updater": "Check for updates"
|
"settings-updater": "Check for updates"
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,6 @@
|
||||||
"settings-prfmMode-battery": "Batería",
|
"settings-prfmMode-battery": "Batería",
|
||||||
"settings-none": "Ninguna",
|
"settings-none": "Ninguna",
|
||||||
"settings-save": "Guardar ajustes",
|
"settings-save": "Guardar ajustes",
|
||||||
"settings-updater": "Buscar una actualización"
|
"settings-updater": "Buscar una actualización",
|
||||||
|
"settings-mobileMode": "Mobile mode"
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,6 @@
|
||||||
"settings-prfmMode-battery": "ذخیره برای باتری",
|
"settings-prfmMode-battery": "ذخیره برای باتری",
|
||||||
"settings-none": "هیچکدام",
|
"settings-none": "هیچکدام",
|
||||||
"settings-save": "ذخیره تنظیمات",
|
"settings-save": "ذخیره تنظیمات",
|
||||||
"settings-updater": "بررسی برای بروزرسانی"
|
"settings-updater": "بررسی برای بروزرسانی",
|
||||||
|
"settings-mobileMode": "Mobile mode"
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,6 @@
|
||||||
"settings-prfmMode": "Mode performance :",
|
"settings-prfmMode": "Mode performance :",
|
||||||
"settings-prfmMode-performance": "Performance",
|
"settings-prfmMode-performance": "Performance",
|
||||||
"settings-prfmMode-battery": "Batterie",
|
"settings-prfmMode-battery": "Batterie",
|
||||||
"settings-none": "Aucun"
|
"settings-none": "Aucun",
|
||||||
|
"settings-mobileMode": "Mobile mode"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +1,31 @@
|
||||||
{
|
{
|
||||||
"loading_screen_start": "Starting ArmCord…",
|
"loading_screen_start": "memulai ArmCord…",
|
||||||
"loading_screen_offline": "You appear to be offline. Please connect to the Internet and try again.",
|
"loading_screen_offline": "tampaknya anda sedang offline. Silahkan sambungkan ke internet dan coba lagi.",
|
||||||
"loading_screen_update": "A new version of ArmCord is available. Please update to the latest version.",
|
"loading_screen_update": "versi terbaru ArmCord tersedia. Silahkan perbaharui ke versi terbaru.",
|
||||||
"setup_question1": "Select what kind of setup you want to perform:",
|
"setup_question1": "pilih jenis pengaturan yang ingin anda tampilkan:",
|
||||||
"setup_question1_answer1": "Express setup",
|
"setup_question1_answer1": "pengaturan cepat",
|
||||||
"setup_question1_answer2": "Full setup",
|
"setup_question1_answer2": "pengaturan penuh",
|
||||||
"setup_question2": "Choose your Discord channel/instance:",
|
"setup_question2": "pilih saluran Discord anda/instansi:",
|
||||||
"setup_offline": "You appear to be offline. Please connect to the Internet and restart the ArmCord setup.",
|
"setup_offline": "tampaknya anda sedang offline. silahkan sambungkan ke internet dan muat ulang ArmCord.",
|
||||||
"setup_question3": "Should ArmCord handle client mods installation?",
|
"setup_question3": "bolehkah ArmCord menangani pemasangan mods klien?",
|
||||||
"yes": "Yes",
|
"yes": "iya",
|
||||||
"no": "No",
|
"no": "tidak",
|
||||||
"next": "Next",
|
"next": "berikutnya",
|
||||||
"setup_question4": "Select a client mod you want to install:",
|
"setup_question4": "Pilih mod klien yang ingin anda pasang:",
|
||||||
"setup_question4_clientmodnotice": "Why not all of them? Having many client mods at the same time can cause issues. If you really want to do it though, check our documentation.",
|
"setup_question4_clientmodnotice": "kenapa tidak semuanya? memiliki mod klien lebih saat bersamaan bisa menyebabkan masalah. jika anda tetap ingin melakukannya, cek di Discord kami.",
|
||||||
"settings-theme": "ArmCord Theme:",
|
"settings-theme": "Tema ArmCord:",
|
||||||
"settings-theme-default": "Default",
|
"settings-theme-default": "Bawaan",
|
||||||
"settings-theme-native": "Native",
|
"settings-theme-native": "asli",
|
||||||
"settings-tray": "Minimize to tray",
|
"settings-tray": "kecilkan ke tray",
|
||||||
"settings-patches": "Automatic Patches",
|
"settings-patches": "Patch otomatis",
|
||||||
"settings-channel": "Discord channel:",
|
"settings-channel": "Saluran Discord:",
|
||||||
"settings-invitewebsocket": "discord.gg support",
|
"settings-invitewebsocket": "mengajak soket web",
|
||||||
"settings-mod": "Client mod:",
|
"settings-mod": "klien mod:",
|
||||||
"settings-save": "Save settings",
|
"settings-save": "simpan pengaturan",
|
||||||
"settings-updater": "Check for updates",
|
"settings-updater": "periksa pembaharuan",
|
||||||
"settings-prfmMode": "Performance mode:",
|
"settings-prfmMode": "mode kinerja:",
|
||||||
"settings-prfmMode-performance": "Performance",
|
"settings-prfmMode-performance": "kinerja",
|
||||||
"settings-prfmMode-battery": "Battery",
|
"settings-prfmMode-battery": "Baterai",
|
||||||
"settings-none": "None"
|
"settings-none": "tidak ada",
|
||||||
|
"settings-mobileMode": "Mobile mode"
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,6 @@
|
||||||
"settings-prfmMode": "Performance mode:",
|
"settings-prfmMode": "Performance mode:",
|
||||||
"settings-prfmMode-performance": "Performance",
|
"settings-prfmMode-performance": "Performance",
|
||||||
"settings-prfmMode-battery": "Battery",
|
"settings-prfmMode-battery": "Battery",
|
||||||
"settings-none": "None"
|
"settings-none": "None",
|
||||||
|
"settings-mobileMode": "Mobile mode"
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,6 @@
|
||||||
"settings-prfmMode": "Performance mode:",
|
"settings-prfmMode": "Performance mode:",
|
||||||
"settings-prfmMode-performance": "Performance",
|
"settings-prfmMode-performance": "Performance",
|
||||||
"settings-prfmMode-battery": "Battery",
|
"settings-prfmMode-battery": "Battery",
|
||||||
"settings-none": "None"
|
"settings-none": "None",
|
||||||
|
"settings-mobileMode": "Mobile mode"
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,6 @@
|
||||||
"settings-none": "None",
|
"settings-none": "None",
|
||||||
"settings-prfmMode": "Performance mode:",
|
"settings-prfmMode": "Performance mode:",
|
||||||
"settings-prfmMode-performance": "Performance",
|
"settings-prfmMode-performance": "Performance",
|
||||||
"settings-prfmMode-battery": "Battery"
|
"settings-prfmMode-battery": "Battery",
|
||||||
|
"settings-mobileMode": "Mobile mode"
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,6 @@
|
||||||
"settings-prfmMode": "Tryb wydajności:",
|
"settings-prfmMode": "Tryb wydajności:",
|
||||||
"settings-prfmMode-performance": "Wydajny",
|
"settings-prfmMode-performance": "Wydajny",
|
||||||
"settings-prfmMode-battery": "Bateria",
|
"settings-prfmMode-battery": "Bateria",
|
||||||
"settings-none": "Nic/Brak"
|
"settings-none": "Nic/Brak",
|
||||||
|
"settings-mobileMode": "Mobile mode"
|
||||||
}
|
}
|
||||||
|
|
31
assets/lang/pt-BR.json
Normal file
31
assets/lang/pt-BR.json
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"no": "Não",
|
||||||
|
"loading_screen_start": "Iniciando ArmCord…",
|
||||||
|
"loading_screen_offline": "Você parece estar offline. Conecte-se à internet e tente novamente.",
|
||||||
|
"loading_screen_update": "Uma nova versão do ArmCord está disponível. Atualize para a versão mais recente.",
|
||||||
|
"setup_question1": "Selecione que tipo de instação você quer fazer:",
|
||||||
|
"setup_question1_answer1": "Instalação rápida",
|
||||||
|
"setup_question1_answer2": "Instalação completa",
|
||||||
|
"setup_offline": "Você parece estar offline. Conecte-se à internet e tente novamente.",
|
||||||
|
"setup_question2": "Escolha o canal/instância do seu Discord",
|
||||||
|
"setup_question3": "O ArmCord deve suportar a instalação dos mods de cliente?",
|
||||||
|
"yes": "Sim",
|
||||||
|
"next": "Próximo",
|
||||||
|
"setup_question4": "Selecione um mod de cliente que você quer instalar:",
|
||||||
|
"setup_question4_clientmodnotice": "Por que não todos eles? Tendo vários mods de cliente ao mesmo tempo pode causar problemas, Se você realmente quer fazer isso mesmo assim, veja o nosso Discord.",
|
||||||
|
"settings-theme": "Tema do ArmCord:",
|
||||||
|
"settings-theme-default": "Padrão",
|
||||||
|
"settings-theme-native": "Nativo",
|
||||||
|
"settings-tray": "Minimizar para a bandeja",
|
||||||
|
"settings-patches": "Patches automáticos",
|
||||||
|
"settings-channel": "Tipo de Discord:",
|
||||||
|
"settings-invitewebsocket": "Invite Websocket",
|
||||||
|
"settings-mod": "Client mod:",
|
||||||
|
"settings-prfmMode": "Performance mode:",
|
||||||
|
"settings-prfmMode-performance": "Performance",
|
||||||
|
"settings-prfmMode-battery": "Battery",
|
||||||
|
"settings-none": "None",
|
||||||
|
"settings-save": "Save Settings",
|
||||||
|
"settings-updater": "Check for updates",
|
||||||
|
"settings-mobileMode": "Mobile mode"
|
||||||
|
}
|
31
assets/lang/ru-RU.json
Normal file
31
assets/lang/ru-RU.json
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"loading_screen_start": "Запуск ArmCord…",
|
||||||
|
"loading_screen_offline": "Видимо, вы не в сети. Подключитесь к Интернету и повторите попытку.",
|
||||||
|
"loading_screen_update": "Доступна новая версия ArmCord. Обновите до последней версии.",
|
||||||
|
"setup_question1": "Выберите, какую настройку хотите выполнить:",
|
||||||
|
"setup_question1_answer1": "Экспресс-настройка",
|
||||||
|
"setup_question1_answer2": "Полная настройка",
|
||||||
|
"setup_offline": "Видимо, вы не в сети. Подключитесь к Интернету и перезапустите ArmCord.",
|
||||||
|
"setup_question2": "Выберите свой канал/экземпляр Discord:",
|
||||||
|
"setup_question3": "Должен ли ArmCord заниматься установкой клиентских модов?",
|
||||||
|
"yes": "Да",
|
||||||
|
"no": "Нет",
|
||||||
|
"next": "Далее",
|
||||||
|
"setup_question4": "Выберите клиентский мод, который хотите установить:",
|
||||||
|
"setup_question4_clientmodnotice": "Почему не все? Наличие множества клиентских модов одновременно может вызвать проблемы. Если вы действительно хотите это сделать, посетите наш Discord.",
|
||||||
|
"settings-theme": "Тема ArmCord:",
|
||||||
|
"settings-theme-default": "По умолчанию",
|
||||||
|
"settings-theme-native": "Нативная",
|
||||||
|
"settings-tray": "Свернуть в область уведомлений",
|
||||||
|
"settings-patches": "Автоматические патчи",
|
||||||
|
"settings-channel": "Канал Discord:",
|
||||||
|
"settings-invitewebsocket": "Пригласить Websocket",
|
||||||
|
"settings-mod": "Клиентский мод:",
|
||||||
|
"settings-prfmMode": "Режим производительности:",
|
||||||
|
"settings-prfmMode-performance": "Производительность",
|
||||||
|
"settings-prfmMode-battery": "Батарея",
|
||||||
|
"settings-none": "Ничего",
|
||||||
|
"settings-save": "Сохранить настройки",
|
||||||
|
"settings-updater": "Проверить наличие обновлений",
|
||||||
|
"settings-mobileMode": "Mobile mode"
|
||||||
|
}
|
|
@ -26,5 +26,6 @@
|
||||||
"settings-mod": "ไคลแอนต์มอด:",
|
"settings-mod": "ไคลแอนต์มอด:",
|
||||||
"settings-none": "ไม่มี",
|
"settings-none": "ไม่มี",
|
||||||
"settings-save": "บันทึกการตั้งค่า",
|
"settings-save": "บันทึกการตั้งค่า",
|
||||||
"settings-updater": "ตรวจหาการอัปเดต"
|
"settings-updater": "ตรวจหาการอัปเดต",
|
||||||
|
"settings-mobileMode": "โหมดมือถือ"
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
"watch": "tsc -w",
|
"watch": "tsc -w",
|
||||||
"start": "npm run build && electron ./ts-out/main.js",
|
"start": "npm run build && electron ./ts-out/main.js",
|
||||||
"package": "npm run build && electron-builder",
|
"package": "npm run build && electron-builder",
|
||||||
|
"packageQuick": "npm run build && electron-builder --dir",
|
||||||
"format": "prettier --write src/**/*",
|
"format": "prettier --write src/**/*",
|
||||||
"CIbuild": "npm run build && electron-builder --linux zip && electron-builder --windows zip && electron-builder --macos zip",
|
"CIbuild": "npm run build && electron-builder --linux zip && electron-builder --windows zip && electron-builder --macos zip",
|
||||||
"postinstall": "husky install"
|
"postinstall": "husky install"
|
||||||
|
@ -26,8 +27,8 @@
|
||||||
"@types/node": "^17.0.42",
|
"@types/node": "^17.0.42",
|
||||||
"@types/ws": "^8.5.3",
|
"@types/ws": "^8.5.3",
|
||||||
"copyfiles": "^2.4.1",
|
"copyfiles": "^2.4.1",
|
||||||
"electron": "^19.0.7",
|
"electron": "^19.0.8",
|
||||||
"electron-builder": "^23.0.3",
|
"electron-builder": "^23.1.0",
|
||||||
"husky": "^8.0.1",
|
"husky": "^8.0.1",
|
||||||
"prettier": "^2.7.0",
|
"prettier": "^2.7.0",
|
||||||
"typescript": "^4.7.3"
|
"typescript": "^4.7.3"
|
||||||
|
|
6
src/content/css/mobile.css
Normal file
6
src/content/css/mobile.css
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[aria-label~="Mute"] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
[aria-label~="Deafen"] {
|
||||||
|
display: none;
|
||||||
|
}
|
68
src/content/css/screenshare.css
Normal file
68
src/content/css/screenshare.css
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
.desktop-capturer-selection {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
background: rgba(30, 30, 30, 0.75);
|
||||||
|
color: #ffffff;
|
||||||
|
z-index: 10000000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.desktop-capturer-selection__scroller {
|
||||||
|
width: 100%;
|
||||||
|
max-height: 100vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.desktop-capturer-selection__list {
|
||||||
|
max-width: calc(100% - 100px);
|
||||||
|
margin: 50px;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
list-style: none;
|
||||||
|
overflow: hidden;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.desktop-capturer-selection__item {
|
||||||
|
display: flex;
|
||||||
|
margin: 4px;
|
||||||
|
}
|
||||||
|
.desktop-capturer-selection__btn {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
width: 145px;
|
||||||
|
margin: 0;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 4px;
|
||||||
|
background: #2c2f33;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
@media (prefers-reduced-motion: no-preference) {
|
||||||
|
}
|
||||||
|
.desktop-capturer-selection__btn:hover,
|
||||||
|
.desktop-capturer-selection__btn:focus {
|
||||||
|
background: #7289da;
|
||||||
|
box-shadow: 0 0 4px rgba(0, 0, 0, 0.45), 0 0 2px rgba(0, 0, 0, 0.25);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.desktop-capturer-selection__thumbnail {
|
||||||
|
width: 100%;
|
||||||
|
height: 81px;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
.desktop-capturer-selection__name {
|
||||||
|
margin: 6px 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
color: white;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
text-align: center;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.desktop-capturer-selection__name--cancel {
|
||||||
|
margin: auto 0;
|
||||||
|
}
|
|
@ -38,7 +38,7 @@ SOFTWARE.*/
|
||||||
font-family: Whitney;
|
font-family: Whitney;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
src: url(https://armcord.smartfridge.space/whitney_400.woff) format("woff");
|
src: url(https://armcord.xyz/whitney_400.woff) format("woff");
|
||||||
}
|
}
|
||||||
|
|
||||||
html,
|
html,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
font-family: Whitney;
|
font-family: Whitney;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
src: url(https://armcord.smartfridge.space/whitney_400.woff) format("woff");
|
src: url(https://armcord.xyz/whitney_400.woff) format("woff");
|
||||||
}
|
}
|
||||||
|
|
||||||
html,
|
html,
|
||||||
|
|
|
@ -31,7 +31,7 @@ SOFTWARE.*/
|
||||||
font-family: Whitney;
|
font-family: Whitney;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
src: url(https://armcord.smartfridge.space/whitney_400.woff) format("woff");
|
src: url(https://armcord.xyz/whitney_400.woff) format("woff");
|
||||||
}
|
}
|
||||||
|
|
||||||
html,
|
html,
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<option value="stable">Stable</option>
|
<option value="stable">Stable</option>
|
||||||
<option value="canary">Canary</option>
|
<option value="canary">Canary</option>
|
||||||
<option value="ptb">PTB</option>
|
<option value="ptb">PTB</option>
|
||||||
<option value="foss">Fosscord</option>
|
<option value="hummus">Hummus (unofficial)</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<p class="text-center setup-ask" id="setup_question3">
|
<p class="text-center setup-ask" id="setup_question3">
|
||||||
|
@ -121,6 +121,7 @@
|
||||||
automaticPatches: false,
|
automaticPatches: false,
|
||||||
mods: "cumcord",
|
mods: "cumcord",
|
||||||
inviteWebsocket: true,
|
inviteWebsocket: true,
|
||||||
|
mobileMode: false,
|
||||||
trayIcon: "ac_plug_colored",
|
trayIcon: "ac_plug_colored",
|
||||||
performanceMode: "none"
|
performanceMode: "none"
|
||||||
});
|
});
|
||||||
|
@ -148,8 +149,8 @@
|
||||||
windowStyle: "default",
|
windowStyle: "default",
|
||||||
channel: options.channel,
|
channel: options.channel,
|
||||||
armcordCSP: true,
|
armcordCSP: true,
|
||||||
autoLaunch: true,
|
|
||||||
minimizeToTray: true,
|
minimizeToTray: true,
|
||||||
|
mobileMode: false,
|
||||||
automaticPatches: false,
|
automaticPatches: false,
|
||||||
performanceMode: "none",
|
performanceMode: "none",
|
||||||
trayIcon: "ac_plug_colored",
|
trayIcon: "ac_plug_colored",
|
||||||
|
@ -165,7 +166,7 @@
|
||||||
armcordCSP: true,
|
armcordCSP: true,
|
||||||
minimizeToTray: true,
|
minimizeToTray: true,
|
||||||
automaticPatches: false,
|
automaticPatches: false,
|
||||||
autoLaunch: true,
|
mobileMode: false,
|
||||||
mods: "none",
|
mods: "none",
|
||||||
performanceMode: "none",
|
performanceMode: "none",
|
||||||
trayIcon: "ac_plug_colored",
|
trayIcon: "ac_plug_colored",
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<video autoplay loop class="logo" id="splashscreen-armcord">
|
<video autoplay loop class="logo" id="splashscreen-armcord">
|
||||||
<source src="https://armcord.smartfridge.space/discord_loading.webm" type="video/webm" />
|
<source src="https://armcord.xyz/discord_loading.webm" type="video/webm" />
|
||||||
</video>
|
</video>
|
||||||
<p id="text-splashscreen"></p>
|
<p id="text-splashscreen"></p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
if (data.version !== window.armcord.version) {
|
if (data.version !== window.armcord.version) {
|
||||||
var elem = document.createElement("img");
|
var elem = document.createElement("img");
|
||||||
elem.classList.add("logo");
|
elem.classList.add("logo");
|
||||||
elem.src = "https://armcord.smartfridge.space/update.webp";
|
elem.src = "https://armcord.xyz/update.webp";
|
||||||
document.body.prepend(elem);
|
document.body.prepend(elem);
|
||||||
document.getElementById("splashscreen-armcord").remove();
|
document.getElementById("splashscreen-armcord").remove();
|
||||||
text.innerHTML = await armcord.getLang("loading_screen_update");
|
text.innerHTML = await armcord.getLang("loading_screen_update");
|
||||||
|
@ -58,8 +58,8 @@
|
||||||
case "ptb":
|
case "ptb":
|
||||||
window.location.replace("https://ptb.discord.com/app");
|
window.location.replace("https://ptb.discord.com/app");
|
||||||
break;
|
break;
|
||||||
case "foss":
|
case "hummus":
|
||||||
window.location.replace("https://dev.fosscord.com/app");
|
window.location.replace("https://hummus.sys42.net/");
|
||||||
break;
|
break;
|
||||||
case undefined:
|
case undefined:
|
||||||
window.location.replace("https://discord.com/app");
|
window.location.replace("https://discord.com/app");
|
||||||
|
|
|
@ -27,7 +27,8 @@ const unstrictCSP = () => {
|
||||||
"https://api.goosemod.com/inject.js",
|
"https://api.goosemod.com/inject.js",
|
||||||
"https://raw.githubusercontent.com/Cumcord/Cumcord/stable/dist/build.js",
|
"https://raw.githubusercontent.com/Cumcord/Cumcord/stable/dist/build.js",
|
||||||
"https://raw.githubusercontent.com/Cumcord/Cumcord/master/dist/build.js",
|
"https://raw.githubusercontent.com/Cumcord/Cumcord/master/dist/build.js",
|
||||||
"https://raw.githubusercontent.com/FlickerMod/dist/main/build.js"
|
"https://raw.githubusercontent.com/FlickerMod/dist/main/build.js",
|
||||||
|
"https://localhost:1234/dist.js"
|
||||||
];
|
];
|
||||||
|
|
||||||
electron.session.defaultSession.webRequest.onHeadersReceived(({responseHeaders, url}, done) => {
|
electron.session.defaultSession.webRequest.onHeadersReceived(({responseHeaders, url}, done) => {
|
||||||
|
|
|
@ -50,7 +50,7 @@ export function registerIpc() {
|
||||||
var height= await getWindowState("height") ?? 600;
|
var height= await getWindowState("height") ?? 600;
|
||||||
var isMaximized = await getWindowState("isMaximized") ?? false;
|
var isMaximized = await getWindowState("isMaximized") ?? false;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("No window state file found. Fallbacking to default values.")
|
console.log("[Window state manager] No window state file found. Fallbacking to default values.")
|
||||||
mainWindow.setSize(800, 600);
|
mainWindow.setSize(800, 600);
|
||||||
}
|
}
|
||||||
if (isMaximized) {
|
if (isMaximized) {
|
||||||
|
@ -58,7 +58,7 @@ export function registerIpc() {
|
||||||
mainWindow.maximize()
|
mainWindow.maximize()
|
||||||
} else {
|
} else {
|
||||||
mainWindow.setSize(width, height);
|
mainWindow.setSize(width, height);
|
||||||
console.log("Not maximized.")
|
console.log("[Window state manager] Not maximized.")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ipcMain.on("restart", (event, arg) => {
|
ipcMain.on("restart", (event, arg) => {
|
||||||
|
@ -83,6 +83,9 @@ export function registerIpc() {
|
||||||
ipcMain.on("titlebar", (event, arg) => {
|
ipcMain.on("titlebar", (event, arg) => {
|
||||||
event.returnValue = customTitlebar;
|
event.returnValue = customTitlebar;
|
||||||
});
|
});
|
||||||
|
ipcMain.on("mobileMode", async (event, arg) => {
|
||||||
|
event.returnValue = await getConfig("mobileMode");
|
||||||
|
});
|
||||||
ipcMain.on("shouldPatch", async (event, arg) => {
|
ipcMain.on("shouldPatch", async (event, arg) => {
|
||||||
event.returnValue = await getConfig("automaticPatches");
|
event.returnValue = await getConfig("automaticPatches");
|
||||||
});
|
});
|
||||||
|
|
54
src/main.ts
54
src/main.ts
|
@ -6,7 +6,6 @@ import "./extensions/mods";
|
||||||
import "./extensions/plugin";
|
import "./extensions/plugin";
|
||||||
import "./tray";
|
import "./tray";
|
||||||
import {createCustomWindow, createNativeWindow} from "./window";
|
import {createCustomWindow, createNativeWindow} from "./window";
|
||||||
import "./shortcuts";
|
|
||||||
|
|
||||||
export var settings: any;
|
export var settings: any;
|
||||||
export var customTitlebar: boolean;
|
export var customTitlebar: boolean;
|
||||||
|
@ -26,22 +25,25 @@ if (process.platform == "linux") {
|
||||||
checkIfConfigExists();
|
checkIfConfigExists();
|
||||||
injectElectronFlags();
|
injectElectronFlags();
|
||||||
app.whenReady().then(async () => {
|
app.whenReady().then(async () => {
|
||||||
switch (await getConfig("windowStyle")) {
|
async function init() {
|
||||||
case "default":
|
switch (await getConfig("windowStyle")) {
|
||||||
createCustomWindow();
|
case "default":
|
||||||
customTitlebar = true;
|
createCustomWindow();
|
||||||
break;
|
customTitlebar = true;
|
||||||
case "native":
|
break;
|
||||||
createNativeWindow();
|
case "native":
|
||||||
break;
|
createNativeWindow();
|
||||||
case "basic":
|
break;
|
||||||
createNativeWindow();
|
case "basic":
|
||||||
break;
|
createNativeWindow();
|
||||||
default:
|
break;
|
||||||
createCustomWindow();
|
default:
|
||||||
customTitlebar = true;
|
createCustomWindow();
|
||||||
break;
|
customTitlebar = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
await init()
|
||||||
session.fromPartition("some-partition").setPermissionRequestHandler((webContents, permission, callback) => {
|
session.fromPartition("some-partition").setPermissionRequestHandler((webContents, permission, callback) => {
|
||||||
if (permission === "notifications") {
|
if (permission === "notifications") {
|
||||||
// Approves the permissions request
|
// Approves the permissions request
|
||||||
|
@ -54,24 +56,6 @@ app.whenReady().then(async () => {
|
||||||
});
|
});
|
||||||
app.on("activate", async function () {
|
app.on("activate", async function () {
|
||||||
if (BrowserWindow.getAllWindows().length === 0)
|
if (BrowserWindow.getAllWindows().length === 0)
|
||||||
switch (await getConfig("windowStyle")) {
|
await init()
|
||||||
case "default":
|
|
||||||
createCustomWindow();
|
|
||||||
break;
|
|
||||||
case "native":
|
|
||||||
createNativeWindow();
|
|
||||||
break;
|
|
||||||
case "discord":
|
|
||||||
createNativeWindow();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
createCustomWindow();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
console.log("userDataPath = " + app.getPath("userData"));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on("window-all-closed", function () {
|
|
||||||
if (process.platform !== "darwin") app.quit();
|
|
||||||
});
|
|
||||||
|
|
51
src/menu.ts
Normal file
51
src/menu.ts
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
import { Menu, app, clipboard, globalShortcut } from "electron";
|
||||||
|
import {mainWindow} from "./window";
|
||||||
|
|
||||||
|
function paste(contents: any) {
|
||||||
|
const contentTypes = clipboard.availableFormats().toString();
|
||||||
|
//Workaround: fix pasting the images.
|
||||||
|
if(contentTypes.includes('image/') && contentTypes.includes('text/html')) {
|
||||||
|
clipboard.writeImage(clipboard.readImage());
|
||||||
|
}
|
||||||
|
contents.paste();
|
||||||
|
}
|
||||||
|
export function setMenu() {
|
||||||
|
globalShortcut.register("CmdOrCtrl+V", function () {
|
||||||
|
if (mainWindow.isFocused()) {
|
||||||
|
paste(mainWindow.webContents)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
var template: Electron.MenuItemConstructorOptions[] = [{
|
||||||
|
label: "ArmCord",
|
||||||
|
submenu: [
|
||||||
|
{label: "About ArmCord", role: "about"},//orderFrontStandardAboutPanel
|
||||||
|
{type: "separator"},
|
||||||
|
{
|
||||||
|
label: "Developer tools", accelerator: "CmdOrCtrl+Shift+I", click: function () {
|
||||||
|
mainWindow.webContents.openDevTools()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Quit", accelerator: "CmdOrCtrl+Q", click: function () {
|
||||||
|
app.quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
label: "Edit",
|
||||||
|
submenu: [
|
||||||
|
{label: "Undo", accelerator: "CmdOrCtrl+Z", role: "undo"},
|
||||||
|
{label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", role: "redo"},
|
||||||
|
{type: "separator"},
|
||||||
|
{label: "Cut", accelerator: "CmdOrCtrl+X", role: "cut"},
|
||||||
|
{label: "Copy", accelerator: "CmdOrCtrl+C", role: "copy"},
|
||||||
|
{label: "Paste", accelerator: "CmdOrCtrl+V", click: function () {
|
||||||
|
paste(mainWindow.webContents)
|
||||||
|
}},
|
||||||
|
{label: "Select All", accelerator: "CmdOrCtrl+A", role: "selectAll"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
|
||||||
|
}
|
|
@ -2,6 +2,8 @@
|
||||||
//original https://github.com/electron/electron/issues/16513#issuecomment-602070250
|
//original https://github.com/electron/electron/issues/16513#issuecomment-602070250
|
||||||
import {ipcRenderer} from "electron";
|
import {ipcRenderer} from "electron";
|
||||||
import {addStyle, addScript} from "../utils";
|
import {addStyle, addScript} from "../utils";
|
||||||
|
import fs from "fs";
|
||||||
|
import path from "path";
|
||||||
const desktopCapturer = {
|
const desktopCapturer = {
|
||||||
getSources: (opts: any) => ipcRenderer.invoke("DESKTOP_CAPTURER_GET_SOURCES", opts)
|
getSources: (opts: any) => ipcRenderer.invoke("DESKTOP_CAPTURER_GET_SOURCES", opts)
|
||||||
};
|
};
|
||||||
|
@ -40,79 +42,6 @@ export async function getDisplayMediaSelector() {
|
||||||
</div>`;
|
</div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const screenShareCSS = `
|
|
||||||
.desktop-capturer-selection {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100vh;
|
|
||||||
background: rgba(30,30,30,.75);
|
|
||||||
color: #FFFFFF;
|
|
||||||
z-index: 10000000;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
.desktop-capturer-selection__scroller {
|
|
||||||
width: 100%;
|
|
||||||
max-height: 100vh;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
.desktop-capturer-selection__list {
|
|
||||||
max-width: calc(100% - 100px);
|
|
||||||
margin: 50px;
|
|
||||||
padding: 0;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
list-style: none;
|
|
||||||
overflow: hidden;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
.desktop-capturer-selection__item {
|
|
||||||
display: flex;
|
|
||||||
margin: 4px;
|
|
||||||
}
|
|
||||||
.desktop-capturer-selection__btn {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: stretch;
|
|
||||||
width: 145px;
|
|
||||||
margin: 0;
|
|
||||||
border: 0;
|
|
||||||
border-radius: 3px;
|
|
||||||
padding: 4px;
|
|
||||||
background: #2C2F33;
|
|
||||||
text-align: left;
|
|
||||||
@media (prefers-reduced-motion: no-preference) {
|
|
||||||
transition: background-color .15s, box-shadow .15s, color .15s;
|
|
||||||
}
|
|
||||||
color: #dedede;
|
|
||||||
}
|
|
||||||
.desktop-capturer-selection__btn:hover,
|
|
||||||
.desktop-capturer-selection__btn:focus {
|
|
||||||
background: #7289DA;
|
|
||||||
box-shadow: 0 0 4px rgba(0,0,0,0.45), 0 0 2px rgba(0,0,0,0.25);
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.desktop-capturer-selection__thumbnail {
|
|
||||||
width: 100%;
|
|
||||||
height: 81px;
|
|
||||||
object-fit: cover;
|
|
||||||
}
|
|
||||||
.desktop-capturer-selection__name {
|
|
||||||
margin: 6px 0;
|
|
||||||
white-space: nowrap;
|
|
||||||
color: white;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.desktop-capturer-selection__name--cancel {
|
|
||||||
margin: auto 0;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const screenShareJS = `
|
const screenShareJS = `
|
||||||
window.navigator.mediaDevices.getDisplayMedia = () => new Promise(async (resolve, reject) => {
|
window.navigator.mediaDevices.getDisplayMedia = () => new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
|
@ -155,6 +84,7 @@ window.navigator.mediaDevices.getDisplayMedia = () => new Promise(async (resolve
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
addScript(screenShareJS);
|
addScript(screenShareJS);
|
||||||
addStyle(screenShareCSS);
|
const screenshareCss = path.join(__dirname, "../", "/content/css/screenshare.css");
|
||||||
|
addStyle(fs.readFileSync(screenshareCss, "utf8"));
|
||||||
console.log("Capturer injected.");
|
console.log("Capturer injected.");
|
||||||
});
|
});
|
||||||
|
|
15
src/preload/mobile.ts
Normal file
15
src/preload/mobile.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import {ipcRenderer} from "electron";
|
||||||
|
import {addStyle} from "../utils";
|
||||||
|
import * as fs from "fs";
|
||||||
|
import * as path from "path";
|
||||||
|
export function injectMobileStuff() {
|
||||||
|
document.addEventListener("DOMContentLoaded", function (event) {
|
||||||
|
const mobileCSS = path.join(__dirname, "../", "/content/css/mobile.css");
|
||||||
|
addStyle(fs.readFileSync(mobileCSS, "utf8"));
|
||||||
|
// TO-DO: clicking on the logo, or additional button triggers ESC button to move around the UI quicker
|
||||||
|
// var logo = document.getElementById("window-title");
|
||||||
|
// logo!.addEventListener("click", () => {
|
||||||
|
//
|
||||||
|
// });
|
||||||
|
});
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import * as path from "path";
|
||||||
import {injectTitlebar} from "./titlebar";
|
import {injectTitlebar} from "./titlebar";
|
||||||
import {sleep, addStyle, injectJS, addScript} from "../utils";
|
import {sleep, addStyle, injectJS, addScript} from "../utils";
|
||||||
import {ipcRenderer} from "electron";
|
import {ipcRenderer} from "electron";
|
||||||
|
import {injectMobileStuff} from "./mobile";
|
||||||
var version = ipcRenderer.sendSync("get-app-version", "app-version");
|
var version = ipcRenderer.sendSync("get-app-version", "app-version");
|
||||||
async function updateLang() {
|
async function updateLang() {
|
||||||
if (window.location.href.indexOf("setup.html") > -1) {
|
if (window.location.href.indexOf("setup.html") > -1) {
|
||||||
|
@ -27,7 +28,7 @@ const clientMods = {
|
||||||
flicker: "https://raw.githubusercontent.com/FlickerMod/dist/main/build.js"
|
flicker: "https://raw.githubusercontent.com/FlickerMod/dist/main/build.js"
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("ArmCord");
|
console.log("ArmCord " + version);
|
||||||
ipcRenderer.on("themeLoader", (event, message) => {
|
ipcRenderer.on("themeLoader", (event, message) => {
|
||||||
addStyle(message);
|
addStyle(message);
|
||||||
});
|
});
|
||||||
|
@ -37,6 +38,9 @@ if (window.location.href.indexOf("splash.html") > -1) {
|
||||||
if (ipcRenderer.sendSync("titlebar")) {
|
if (ipcRenderer.sendSync("titlebar")) {
|
||||||
injectTitlebar();
|
injectTitlebar();
|
||||||
}
|
}
|
||||||
|
if (ipcRenderer.sendSync("mobileMode")) {
|
||||||
|
injectMobileStuff();
|
||||||
|
}
|
||||||
sleep(5000).then(async () => {
|
sleep(5000).then(async () => {
|
||||||
const cssPath = path.join(__dirname, "../", "/content/css/discord.css");
|
const cssPath = path.join(__dirname, "../", "/content/css/discord.css");
|
||||||
addStyle(fs.readFileSync(cssPath, "utf8"));
|
addStyle(fs.readFileSync(cssPath, "utf8"));
|
||||||
|
|
|
@ -5,6 +5,11 @@ import * as path from "path";
|
||||||
import os from "os";
|
import os from "os";
|
||||||
export function injectTitlebar() {
|
export function injectTitlebar() {
|
||||||
document.addEventListener("DOMContentLoaded", function (event) {
|
document.addEventListener("DOMContentLoaded", function (event) {
|
||||||
|
if (window.armcord.channel == "hummus") {
|
||||||
|
window.alert(
|
||||||
|
"ArmCord Titlebar doesn't currently work well in Hummus, please change ArmCord style to native for better experience."
|
||||||
|
);
|
||||||
|
}
|
||||||
var elem = document.createElement("div");
|
var elem = document.createElement("div");
|
||||||
elem.innerHTML = `<nav class="titlebar">
|
elem.innerHTML = `<nav class="titlebar">
|
||||||
<div class="window-title" id="window-title"></div>
|
<div class="window-title" id="window-title"></div>
|
||||||
|
@ -26,7 +31,7 @@ export function injectTitlebar() {
|
||||||
addStyle(fs.readFileSync(titlebarcssPath, "utf8"));
|
addStyle(fs.readFileSync(titlebarcssPath, "utf8"));
|
||||||
addStyle(fs.readFileSync(wordmarkcssPath, "utf8"));
|
addStyle(fs.readFileSync(wordmarkcssPath, "utf8"));
|
||||||
document.body.setAttribute("customTitlebar", "");
|
document.body.setAttribute("customTitlebar", "");
|
||||||
document.body.setAttribute("armcord-platform", "win32");
|
document.body.setAttribute("armcord-platform", os.platform());
|
||||||
|
|
||||||
var minimize = document.getElementById("minimize");
|
var minimize = document.getElementById("minimize");
|
||||||
var maximize = document.getElementById("maximize");
|
var maximize = document.getElementById("maximize");
|
||||||
|
|
|
@ -40,12 +40,18 @@
|
||||||
<input class="tgl tgl-light left" id="websocket" type="checkbox" />
|
<input class="tgl tgl-light left" id="websocket" type="checkbox" />
|
||||||
<label class="tgl-btn left" for="websocket"></label>
|
<label class="tgl-btn left" for="websocket"></label>
|
||||||
</div>
|
</div>
|
||||||
|
<br />
|
||||||
|
<div class="switch">
|
||||||
|
<label class="header" id="settings-mobileMode">Mobile mode</label>
|
||||||
|
<input class="tgl tgl-light left" id="mobile" type="checkbox" />
|
||||||
|
<label class="tgl-btn left" for="mobile"></label>
|
||||||
|
</div>
|
||||||
<div class="switch">
|
<div class="switch">
|
||||||
<select name="channel" id="channel" class="left">
|
<select name="channel" id="channel" class="left">
|
||||||
<option value="stable">Stable</option>
|
<option value="stable">Stable</option>
|
||||||
<option value="canary">Canary</option>
|
<option value="canary">Canary</option>
|
||||||
<option value="ptb">PTB</option>
|
<option value="ptb">PTB</option>
|
||||||
<option value="foss">Fosscord</option>
|
<option value="hummus">Hummus (unofficial)</option>
|
||||||
</select>
|
</select>
|
||||||
<p class="header" id="settings-channel">Discord channel:</p>
|
<p class="header" id="settings-channel">Discord channel:</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -89,6 +95,7 @@
|
||||||
);
|
);
|
||||||
document.getElementById("settings-patches").innerHTML = await settings.getLang("settings-patches");
|
document.getElementById("settings-patches").innerHTML = await settings.getLang("settings-patches");
|
||||||
document.getElementById("settings-tray").innerHTML = await settings.getLang("settings-tray");
|
document.getElementById("settings-tray").innerHTML = await settings.getLang("settings-tray");
|
||||||
|
document.getElementById("settings-mobileMode").innerHTML = await settings.getLang("settings-mobileMode");
|
||||||
document.getElementById("settings-theme").innerHTML = await settings.getLang("settings-theme");
|
document.getElementById("settings-theme").innerHTML = await settings.getLang("settings-theme");
|
||||||
//select stuff
|
//select stuff
|
||||||
document.getElementById("mod").options[3].text = await settings.getLang("settings-none");
|
document.getElementById("mod").options[3].text = await settings.getLang("settings-none");
|
||||||
|
@ -107,6 +114,7 @@
|
||||||
document.getElementById("csp").checked = await settings.get("armcordCSP");
|
document.getElementById("csp").checked = await settings.get("armcordCSP");
|
||||||
document.getElementById("tray").checked = await settings.get("minimizeToTray");
|
document.getElementById("tray").checked = await settings.get("minimizeToTray");
|
||||||
document.getElementById("websocket").checked = await settings.get("inviteWebsocket");
|
document.getElementById("websocket").checked = await settings.get("inviteWebsocket");
|
||||||
|
document.getElementById("mobile").checked = await settings.get("mobileMode");
|
||||||
document.getElementById("patches").value = await settings.get("automaticPatches");
|
document.getElementById("patches").value = await settings.get("automaticPatches");
|
||||||
document.getElementById("mod").value = await settings.get("mods");
|
document.getElementById("mod").value = await settings.get("mods");
|
||||||
document.getElementById("channel").value = await settings.get("channel");
|
document.getElementById("channel").value = await settings.get("channel");
|
||||||
|
@ -123,6 +131,7 @@
|
||||||
minimizeToTray: document.getElementById("tray").checked,
|
minimizeToTray: document.getElementById("tray").checked,
|
||||||
automaticPatches: document.getElementById("patches").checked,
|
automaticPatches: document.getElementById("patches").checked,
|
||||||
mods: document.getElementById("mod").value,
|
mods: document.getElementById("mod").value,
|
||||||
|
mobileMode: document.getElementById("mobile").checked,
|
||||||
inviteWebsocket: document.getElementById("websocket").checked,
|
inviteWebsocket: document.getElementById("websocket").checked,
|
||||||
performanceMode: document.getElementById("prfmMode").value,
|
performanceMode: document.getElementById("prfmMode").value,
|
||||||
trayIcon: document.getElementById("trayIcon").value,
|
trayIcon: document.getElementById("trayIcon").value,
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
import {app} from "electron";
|
|
||||||
import {mainWindow} from "./window";
|
|
||||||
//https://github.com/electron/electron/issues/1334#issuecomment-716080005
|
|
||||||
// TO-DO add more
|
|
||||||
app.on("web-contents-created", (webContentsCreatedEvent, webContents) => {
|
|
||||||
webContents.on("before-input-event", (beforeInputEvent, input) => {
|
|
||||||
// console.log('Main console::', input)
|
|
||||||
const {code, alt, control, shift, meta} = input;
|
|
||||||
// Shortcut: toggle devTools
|
|
||||||
if (shift && control && !alt && !meta && code === "KeyI") {
|
|
||||||
mainWindow.webContents.toggleDevTools();
|
|
||||||
}
|
|
||||||
// Shortcut: window reload
|
|
||||||
if (shift && control && !alt && !meta && code === "KeyR") {
|
|
||||||
mainWindow.reload();
|
|
||||||
}
|
|
||||||
// Shortcut: app reload
|
|
||||||
if (alt && control && !shift && !meta && code === "KeyR") {
|
|
||||||
app.relaunch();
|
|
||||||
app.exit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
12
src/tray.ts
12
src/tray.ts
|
@ -1,5 +1,5 @@
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { app, Menu, Tray } from "electron";
|
import { app, Menu, Tray, nativeImage} from "electron";
|
||||||
import { mainWindow } from "./window";
|
import { mainWindow } from "./window";
|
||||||
import { getConfig, getConfigLocation, setWindowState } from "./utils";
|
import { getConfig, getConfigLocation, setWindowState } from "./utils";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
@ -7,10 +7,13 @@ import { createSettingsWindow } from "./settings/main";
|
||||||
let tray: any = null;
|
let tray: any = null;
|
||||||
app.whenReady().then(async () => {
|
app.whenReady().then(async () => {
|
||||||
let finishedSetup = (await getConfig("doneSetup"));
|
let finishedSetup = (await getConfig("doneSetup"));
|
||||||
|
var trayIcon = (await getConfig("trayIcon")) ?? "ac_plug_colored";
|
||||||
|
let trayPath = nativeImage.createFromPath(path.join(__dirname, "../", `/assets/${trayIcon}.png`));
|
||||||
|
if(process.platform === "darwin" && trayPath.getSize().height > 22)
|
||||||
|
trayPath = trayIcon.resize({height: 22});
|
||||||
if ((await getConfig("windowStyle")) == "basic") {
|
if ((await getConfig("windowStyle")) == "basic") {
|
||||||
var clientName = (await getConfig("clientName")) ?? "ArmCord";
|
var clientName = (await getConfig("clientName")) ?? "ArmCord";
|
||||||
var trayIcon = (await getConfig("trayIcon")) ?? "ac_plug_colored";
|
tray = new Tray(trayPath);
|
||||||
tray = new Tray(path.join(__dirname, "../", `/assets/${trayIcon}.png`));
|
|
||||||
const contextMenu = function () {
|
const contextMenu = function () {
|
||||||
if (finishedSetup == false) {
|
if (finishedSetup == false) {
|
||||||
return Menu.buildFromTemplate([
|
return Menu.buildFromTemplate([
|
||||||
|
@ -57,8 +60,7 @@ app.whenReady().then(async () => {
|
||||||
tray.setContextMenu(contextMenu);
|
tray.setContextMenu(contextMenu);
|
||||||
} else {
|
} else {
|
||||||
var clientName = (await getConfig("clientName")) ?? "ArmCord";
|
var clientName = (await getConfig("clientName")) ?? "ArmCord";
|
||||||
var trayIcon = (await getConfig("trayIcon")) ?? "ac_plug_colored";
|
tray = new Tray(trayPath);
|
||||||
tray = new Tray(path.join(__dirname, "../", `/assets/${trayIcon}.png`));
|
|
||||||
if (finishedSetup == false) {
|
if (finishedSetup == false) {
|
||||||
const contextMenu = Menu.buildFromTemplate([
|
const contextMenu = Menu.buildFromTemplate([
|
||||||
{
|
{
|
||||||
|
|
106
src/utils.ts
106
src/utils.ts
|
@ -2,9 +2,8 @@ import * as fs from "fs";
|
||||||
import { app, dialog } from "electron";
|
import { app, dialog } from "electron";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
export var firstRun: boolean;
|
export var firstRun: boolean;
|
||||||
export var isSetup: boolean;
|
|
||||||
export var contentPath: string;
|
export var contentPath: string;
|
||||||
//utillity functions that are used all over the codebase or just too obscure to be put in the file used in
|
//utility functions that are used all over the codebase or just too obscure to be put in the file used in
|
||||||
export function addStyle(styleString: string) {
|
export function addStyle(styleString: string) {
|
||||||
const style = document.createElement("style");
|
const style = document.createElement("style");
|
||||||
style.textContent = styleString;
|
style.textContent = styleString;
|
||||||
|
@ -43,6 +42,7 @@ export function setup() {
|
||||||
mods: "cumcord",
|
mods: "cumcord",
|
||||||
performanceMode: "none",
|
performanceMode: "none",
|
||||||
inviteWebsocket: true,
|
inviteWebsocket: true,
|
||||||
|
mobileMode: false,
|
||||||
trayIcon: "ac_plug_colored",
|
trayIcon: "ac_plug_colored",
|
||||||
doneSetup: false
|
doneSetup: false
|
||||||
};
|
};
|
||||||
|
@ -104,9 +104,7 @@ export async function injectElectronFlags() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export async function setLang(language: string) {
|
export async function setLang(language: string) {
|
||||||
const userDataPath = app.getPath("userData");
|
const langConfigFile = path.join(app.getPath("userData"), "/storage/") + "lang.json";
|
||||||
const storagePath = path.join(userDataPath, "/storage/");
|
|
||||||
const langConfigFile = storagePath + "lang.json";
|
|
||||||
if (!fs.existsSync(langConfigFile)) {
|
if (!fs.existsSync(langConfigFile)) {
|
||||||
fs.writeFileSync(langConfigFile, "{}", "utf-8");
|
fs.writeFileSync(langConfigFile, "{}", "utf-8");
|
||||||
}
|
}
|
||||||
|
@ -140,7 +138,15 @@ export async function getLang(object: string) {
|
||||||
}
|
}
|
||||||
let rawdata = fs.readFileSync(langPath, "utf-8");
|
let rawdata = fs.readFileSync(langPath, "utf-8");
|
||||||
let parsed = JSON.parse(rawdata);
|
let parsed = JSON.parse(rawdata);
|
||||||
return parsed[object];
|
if (parsed[object] == undefined) {
|
||||||
|
console.log(object + " is undefined in " + language)
|
||||||
|
langPath = path.join(__dirname, "../", "/assets/lang/en-US.json");
|
||||||
|
rawdata = fs.readFileSync(langPath, "utf-8");
|
||||||
|
parsed = JSON.parse(rawdata);
|
||||||
|
return parsed[object]
|
||||||
|
} else {
|
||||||
|
return parsed[object];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//ArmCord Window State manager
|
//ArmCord Window State manager
|
||||||
|
@ -165,9 +171,8 @@ export async function getWindowState(object: string) {
|
||||||
const settingsFile = storagePath + "window.json";
|
const settingsFile = storagePath + "window.json";
|
||||||
let rawdata = fs.readFileSync(settingsFile, "utf-8");
|
let rawdata = fs.readFileSync(settingsFile, "utf-8");
|
||||||
let returndata = JSON.parse(rawdata);
|
let returndata = JSON.parse(rawdata);
|
||||||
console.log(object + ": " + returndata[object]);
|
console.log("[Window state manager] " + object + ": " + returndata[object]);
|
||||||
return returndata[object];
|
return returndata[object];
|
||||||
|
|
||||||
}
|
}
|
||||||
//ArmCord Settings/Storage manager
|
//ArmCord Settings/Storage manager
|
||||||
|
|
||||||
|
@ -178,65 +183,36 @@ export interface Settings {
|
||||||
minimizeToTray: boolean;
|
minimizeToTray: boolean;
|
||||||
automaticPatches: boolean;
|
automaticPatches: boolean;
|
||||||
mods: string;
|
mods: string;
|
||||||
|
mobileMode: boolean,
|
||||||
performanceMode: string;
|
performanceMode: string;
|
||||||
inviteWebsocket: boolean;
|
inviteWebsocket: boolean;
|
||||||
trayIcon: string;
|
trayIcon: string;
|
||||||
doneSetup: boolean;
|
doneSetup: boolean;
|
||||||
}
|
}
|
||||||
export async function getConfig(object: string) {
|
export function getConfigLocation() {
|
||||||
try {
|
const userDataPath = app.getPath("userData");
|
||||||
const userDataPath = app.getPath("userData");
|
const storagePath = path.join(userDataPath, "/storage/");
|
||||||
const storagePath = path.join(userDataPath, "/storage/");
|
return storagePath + "settings.json";
|
||||||
const settingsFile = storagePath + "settings.json";
|
|
||||||
let rawdata = fs.readFileSync(settingsFile, "utf-8");
|
|
||||||
let returndata = JSON.parse(rawdata);
|
|
||||||
console.log(object + ": " + returndata[object]);
|
|
||||||
return returndata[object];
|
|
||||||
} catch (e) {
|
|
||||||
console.log("Config probably doesn't exist yet. Returning setup value.");
|
|
||||||
firstRun = true;
|
|
||||||
return "setup";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
export async function getConfigLocation() {
|
export async function getConfig(object: string) {
|
||||||
try {
|
let rawdata = fs.readFileSync(getConfigLocation(), "utf-8");
|
||||||
const userDataPath = app.getPath("userData");
|
let returndata = JSON.parse(rawdata);
|
||||||
const storagePath = path.join(userDataPath, "/storage/");
|
console.log("[Config manager] " + object + ": " + returndata[object]);
|
||||||
return storagePath + "settings.json";
|
return returndata[object];
|
||||||
} catch (e) {
|
|
||||||
console.log("Config probably doesn't exist yet. Returning setup value.");
|
|
||||||
firstRun = true;
|
|
||||||
return "setup";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
export async function setConfig(object: string, toSet: any) {
|
export async function setConfig(object: string, toSet: any) {
|
||||||
try {
|
let rawdata = fs.readFileSync(getConfigLocation(), "utf-8");
|
||||||
const userDataPath = app.getPath("userData");
|
let parsed = JSON.parse(rawdata);
|
||||||
const storagePath = path.join(userDataPath, "/storage/");
|
parsed[object] = toSet;
|
||||||
const settingsFile = storagePath + "settings.json";
|
let toSave = JSON.stringify(parsed);
|
||||||
let rawdata = fs.readFileSync(settingsFile, "utf-8");
|
fs.writeFileSync(getConfigLocation(), toSave, "utf-8");
|
||||||
let parsed = JSON.parse(rawdata);
|
|
||||||
parsed[object] = toSet;
|
|
||||||
let toSave = JSON.stringify(parsed);
|
|
||||||
fs.writeFileSync(settingsFile, toSave, "utf-8");
|
|
||||||
} catch (e) {
|
|
||||||
console.log("Config probably doesn't exist yet. Returning setup value.");
|
|
||||||
firstRun = true;
|
|
||||||
return "setup";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
export async function setConfigBulk(object: Settings) {
|
export async function setConfigBulk(object: Settings) {
|
||||||
try {
|
const userDataPath = app.getPath("userData");
|
||||||
const userDataPath = app.getPath("userData");
|
const storagePath = path.join(userDataPath, "/storage/");
|
||||||
const storagePath = path.join(userDataPath, "/storage/");
|
const settingsFile = storagePath + "settings.json";
|
||||||
const settingsFile = storagePath + "settings.json";
|
let toSave = JSON.stringify(object);
|
||||||
let toSave = JSON.stringify(object);
|
fs.writeFileSync(settingsFile, toSave, "utf-8");
|
||||||
fs.writeFileSync(settingsFile, toSave, "utf-8");
|
|
||||||
} catch (e) {
|
|
||||||
console.log("Config probably doesn't exist yet. Returning setup value.");
|
|
||||||
firstRun = true;
|
|
||||||
return "setup";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
export async function checkIfConfigExists() {
|
export async function checkIfConfigExists() {
|
||||||
const userDataPath = app.getPath("userData");
|
const userDataPath = app.getPath("userData");
|
||||||
|
@ -250,26 +226,14 @@ export async function checkIfConfigExists() {
|
||||||
}
|
}
|
||||||
console.log("First run of the ArmCord. Starting setup.");
|
console.log("First run of the ArmCord. Starting setup.");
|
||||||
setup();
|
setup();
|
||||||
isSetup = true;
|
firstRun = true;
|
||||||
contentPath = path.join(__dirname, "/content/setup.html");
|
|
||||||
if (!contentPath.includes("ts-out")) {
|
|
||||||
contentPath = path.join(__dirname, "/ts-out/content/setup.html");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ((await getConfig("doneSetup")) == false) {
|
if ((await getConfig("doneSetup")) == false) {
|
||||||
console.log("First run of the ArmCord. Starting setup.");
|
console.log("First run of the ArmCord. Starting setup.");
|
||||||
setup();
|
setup();
|
||||||
isSetup = true;
|
firstRun = true;
|
||||||
contentPath = path.join(__dirname, "/content/setup.html");
|
|
||||||
if (!contentPath.includes("ts-out")) {
|
|
||||||
contentPath = path.join(__dirname, "/ts-out/content/setup.html");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
console.log("ArmCord has been run before. Skipping setup.");
|
console.log("ArmCord has been run before. Skipping setup.");
|
||||||
contentPath = path.join(__dirname, "/content/splash.html");
|
|
||||||
if (!contentPath.includes("ts-out")) {
|
|
||||||
contentPath = path.join(__dirname, "/ts-out/content/splash.html");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
// I'm sorry for this mess but I'm not sure how to fix it.
|
// I'm sorry for this mess but I'm not sure how to fix it.
|
||||||
import { BrowserWindow, shell, app, dialog } from "electron";
|
import { BrowserWindow, shell, app, dialog } from "electron";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { checkIfConfigIsBroken, firstRun, getConfig, contentPath, isSetup, setConfig, setLang, setWindowState } from "./utils";
|
import { checkIfConfigIsBroken, firstRun, getConfig, contentPath, setConfig, setLang, setWindowState } from "./utils";
|
||||||
import { registerIpc } from "./ipc";
|
import { registerIpc } from "./ipc";
|
||||||
|
import { setMenu } from "./menu";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import startServer from "./socket";
|
import startServer from "./socket";
|
||||||
import contextMenu from "electron-context-menu";
|
import contextMenu from "electron-context-menu";
|
||||||
|
@ -25,12 +26,16 @@ async function doAfterDefiningTheWindow() {
|
||||||
var ignoreProtocolWarning = await getConfig("ignoreProtocolWarning");
|
var ignoreProtocolWarning = await getConfig("ignoreProtocolWarning");
|
||||||
checkIfConfigIsBroken();
|
checkIfConfigIsBroken();
|
||||||
registerIpc();
|
registerIpc();
|
||||||
|
if (await getConfig("mobileMode")) {
|
||||||
// A little sloppy but it works :p
|
mainWindow.webContents.userAgent = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.149 Mobile Safari/537.36"
|
||||||
if (osType == 'Windows_NT') {
|
} else {
|
||||||
osType = "Windows " + os.release().split('.')[0] + " (" + os.release() + ")";
|
// A little sloppy but it works :p
|
||||||
|
if (osType == 'Windows_NT') {
|
||||||
|
osType = "Windows " + os.release().split('.')[0] + " (" + os.release() + ")";
|
||||||
|
}
|
||||||
|
mainWindow.webContents.userAgent = `Mozilla/5.0 (X11; ${osType} ${os.arch()}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36`; //fake useragent for screenshare to work
|
||||||
}
|
}
|
||||||
mainWindow.webContents.userAgent = `Mozilla/5.0 (X11; ${osType} ${os.arch()}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36`; //fake useragent for screenshare to work
|
|
||||||
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
|
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
|
||||||
if (url.startsWith("https:" || url.startsWith("http:") || url.startsWith("mailto:"))) {
|
if (url.startsWith("https:" || url.startsWith("http:") || url.startsWith("mailto:"))) {
|
||||||
shell.openExternal(url);
|
shell.openExternal(url);
|
||||||
|
@ -90,7 +95,7 @@ async function doAfterDefiningTheWindow() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
setMenu()
|
||||||
mainWindow.on("close", async (e) => {
|
mainWindow.on("close", async (e) => {
|
||||||
let [width, height] = mainWindow.getSize()
|
let [width, height] = mainWindow.getSize()
|
||||||
setWindowState({
|
setWindowState({
|
||||||
|
@ -114,36 +119,14 @@ async function doAfterDefiningTheWindow() {
|
||||||
})
|
})
|
||||||
console.log(contentPath);
|
console.log(contentPath);
|
||||||
if ((await getConfig("inviteWebsocket")) == true) {
|
if ((await getConfig("inviteWebsocket")) == true) {
|
||||||
startServer();
|
await startServer();
|
||||||
}
|
}
|
||||||
try {
|
if (firstRun) {
|
||||||
mainWindow.loadFile(contentPath);
|
await setLang(Intl.DateTimeFormat().resolvedOptions().locale)
|
||||||
if (isSetup) {
|
mainWindow.setSize(390, 470);
|
||||||
await setLang(Intl.DateTimeFormat().resolvedOptions().locale)
|
await mainWindow.loadFile(path.join(__dirname, "/content/setup.html"));
|
||||||
mainWindow.setSize(390, 470);
|
} else {
|
||||||
}
|
await mainWindow.loadFile(path.join(__dirname, "/content/splash.html"));
|
||||||
} catch (e) {
|
|
||||||
console.log(
|
|
||||||
"Major error detected while starting up. User is most likely on Windows platform. Fallback to alternative startup."
|
|
||||||
);
|
|
||||||
console.log(process.platform);
|
|
||||||
if (process.platform === "win32") {
|
|
||||||
if (firstRun) {
|
|
||||||
await setLang(Intl.DateTimeFormat().resolvedOptions().locale)
|
|
||||||
mainWindow.setSize(390, 470);
|
|
||||||
mainWindow.loadURL(`file://${__dirname}/content/setup.html`);
|
|
||||||
} else {
|
|
||||||
mainWindow.loadURL(`file://${__dirname}/content/splash.html`);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (firstRun) {
|
|
||||||
await setLang(Intl.DateTimeFormat().resolvedOptions().locale)
|
|
||||||
mainWindow.setSize(390, 470);
|
|
||||||
mainWindow.loadURL(`file://${__dirname}/ts-out/content/setup.html`);
|
|
||||||
} else {
|
|
||||||
mainWindow.loadURL(`file://${__dirname}/ts-out/content/splash.html`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function createCustomWindow() {
|
export function createCustomWindow() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue