refactor: discord url

This commit is contained in:
Xmader 2021-05-09 14:27:33 -04:00
parent 9adba49de1
commit f9be984d17
No known key found for this signature in database
GPG Key ID: A20B97FB9EB730E4
3 changed files with 7 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import { ScoreInfo } from './scoreinfo'
import { loadMscore, WebMscore } from './mscore'
import { useTimeout, windowOpenAsync, console, attachShadow } from './utils'
import { useTimeout, windowOpenAsync, console, attachShadow, DISCORD_URL } from './utils'
import { isGmAvailable, _GM } from './gm'
import i18n from './i18n'
// @ts-ignore
@ -277,11 +277,11 @@ export namespace BtnAction {
alert(
'❌Download Failed!\n\n' +
'Send your URL to the #dataset-bugs channel \n ' +
'in the LibreScore Community Discord server: https://discord.gg/kTyx6nUjMv',
'in the LibreScore Community Discord server: ' + DISCORD_URL,
)
// open Discord on 'OK'
const a = document.createElement('a')
a.href = 'https://discord.gg/kTyx6nUjMv'
a.href = DISCORD_URL
a.target = '_blank'
a.dispatchEvent(new MouseEvent('click'))
}

View File

@ -9,7 +9,7 @@ import { fetchMscz, setMscz, MSCZ_URL_SYM } from './mscz'
import { loadMscore, INDV_DOWNLOADS, WebMscore } from './mscore'
import { ScoreInfo, ScoreInfoHtml, ScoreInfoObj, getActualId } from './scoreinfo'
import { getLibreScoreLink } from './librescore-link'
import { escapeFilename } from './utils'
import { escapeFilename, DISCORD_URL } from './utils'
import { isNpx, getVerInfo, getSelfVer } from './npm-data'
import i18n from './i18n'
@ -136,7 +136,7 @@ void (async () => {
spinner.fail(err.message)
spinner.info(
'Send your URL to the #dataset-bugs channel in the LibreScore Community Discord server:\n ' +
'https://discord.gg/kTyx6nUjMv',
DISCORD_URL,
)
return
}

View File

@ -2,6 +2,8 @@
import isNodeJs from 'detect-node'
import { isGmAvailable, _GM } from './gm'
export const DISCORD_URL = 'https://discord.gg/kTyx6nUjMv'
export const escapeFilename = (s: string): string => {
return s.replace(/[\s<>:{}"/\\|?*~.\0\cA-\cZ]+/g, '_')
}