Skip to content

Commit

Permalink
refactor: discord url
Browse files Browse the repository at this point in the history
  • Loading branch information
Xmader committed May 9, 2021
1 parent 9adba49 commit f9be984
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/btn.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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'))
}
Expand Down
4 changes: 2 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, '_')
}
Expand Down

0 comments on commit f9be984

Please sign in to comment.