diff --git a/src/btn.ts b/src/btn.ts index e8800e3..472ad42 100644 --- a/src/btn.ts +++ b/src/btn.ts @@ -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')) } diff --git a/src/cli.ts b/src/cli.ts index 01d228f..fa80640 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -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 } diff --git a/src/utils.ts b/src/utils.ts index 9d1a398..eca2fe4 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -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, '_') }