fix: crash when custom front is activated

This commit is contained in:
Bee 2025-01-02 12:22:37 -08:00
parent 5e0fe8aa0c
commit b33335d18a
4 changed files with 13 additions and 7 deletions

View file

@ -1,7 +1,7 @@
# Compatiplural
url_override="https://v2.apparyllis.com"
url_override="https://api.apparyllis.com"
api_version="v1"
socket="wss://v2.apparyllis.com/v1/socket"
socket="wss://api.apparyllis.com/v1/socket"
pk_url="https://api.pluralkit.me/v2"
token="SIMPLYPLURAL_TOKEN"
userId="abcd1234"
@ -10,3 +10,4 @@ heartbeat=4500000
max_workers=1
silence_connections=true
full_swap=false
primary_tag="primary"

2
.gitignore vendored
View file

@ -5,3 +5,5 @@ config.json
package-lock.json
.env
.vercel
docker_build.bat
docker_run.bat

View file

@ -9,9 +9,9 @@ This project already has a Procfile set up, so it's super easy to get started. O
These can be set either in the .env file, in terminal, or in the config vars section of Heroku.
| Setting | Default | Description |
| ---------| ------- | ------------------ |
| url_override | https://v2.apparyllis.com | The base URL for all SimplyPlural API requests. Unless you are running your own fork of Simply Plural, you shouldn't change this. |
| url_override | https://api.apparyllis.com | The base URL for all SimplyPlural API requests. Unless you are running your own fork of Simply Plural, you shouldn't change this. |
| api_version | v1 | The target SimplyPlural API version. Unless you are running your own fork of Simply Plural, you shouldn't change this. |
| socket | wss://v2.apparyllis.com/v1/socket | The socket URL for SimplyPlural. Unless you are running your own fork of Simply Plural, you shouldn't change this. |
| socket | wss://api.apparyllis.com/v1/socket | The socket URL for SimplyPlural. Unless you are running your own fork of Simply Plural, you shouldn't change this. |
| pk_url | https://api.pluralkit.me/v2 | The base URL for all PluralKit API requests. Unless you are running your own fork of PluralKit, you shouldn't change this. |
| token | token_here | Your SimplyPlural account token. As of now, the only permission necessary is the Read permission. |
| userId | user_id | Your SimplyPlural account/system ID. You can find it in account info near the bottom. |

View file

@ -50,7 +50,7 @@ async function findPrimary() {
return new Promise(async (resolve) => {
await Util.asyncForEach(fronters, async (fronter) => {
if (fronter.content.customStatus) {
if (fronter.content.customStatus.toLowerCase().includes("primary")) {
if (fronter.content.customStatus.toLowerCase().includes(Config.primary_tag)) {
let member = await system.getMemberById(fronter.content.member)
resolve({ name: member.content.name, pkId: member.content.pkId })
found = true
@ -116,11 +116,14 @@ async function swapFront() {
for (member of front) {
let m = await system.getMemberById(member.content.member)
if (m.content.pkId) {
if (m.content && m.content.pkId) {
// fronting member pkID has been found
newFront.push(m.content.pkId)
frontNames.push(m.content.name)
}
else {
console.warn('::SimplyWS:: System member not found, this may be a custom front which is unsupported.')
}
}
// shift primary fronter to first in list