refactor(invidious/nitter): combine commands. fix(config): spelling error
This commit is contained in:
parent
5ed4b932d5
commit
f201637677
2 changed files with 12 additions and 2 deletions
|
@ -18,8 +18,8 @@ module.exports = {
|
|||
nitter: {
|
||||
domain: 'nitter.net',
|
||||
userAgent: 'Mozilla/4.0 (compatible; Beep Boop)',
|
||||
domains: [ 'nitter.net', 'www.nitter.net', 'twitter.com', 'wwww.twitter.com' ],
|
||||
check: '(✓)'
|
||||
domains: [ 'nitter.net', 'www.nitter.net', 'twitter.com', 'www.twitter.com' ],
|
||||
check: '(✅)'
|
||||
},
|
||||
invidious: {
|
||||
domain: 'invidious.fdn.fr',
|
||||
|
|
10
main.js
10
main.js
|
@ -72,6 +72,16 @@ let CreateClient = (token, user_id) => {
|
|||
});
|
||||
command = 'media';
|
||||
break;
|
||||
case 'proxy':
|
||||
try {
|
||||
const url = new URL(userInput);
|
||||
command = registrar.config.invidious.domains.includes(url.hostname)
|
||||
? 'invidious'
|
||||
: registrar.config.nitter.domains.includes(url.hostname)
|
||||
? 'nitter'
|
||||
: 'proxy';
|
||||
} catch(e) {}
|
||||
//fallthrough
|
||||
default:
|
||||
args.push(matrixClient, room, userInput, registrar);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue