-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'default' into hcaptcha
- Loading branch information
Showing
50 changed files
with
1,099 additions
and
324 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
open-pull-requests-limit: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Publish Updated Config Schemas | ||
|
||
on: | ||
push: | ||
branches: [default] | ||
# Maybe should do it on release instead? | ||
# release: | ||
# types: [published] | ||
|
||
jobs: | ||
dispatch: | ||
name: Dispatch | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: peter-evans/repository-dispatch@v1 | ||
with: | ||
repository: u-wave/federation | ||
token: ${{secrets.SCHEMA_ACCESS_TOKEN}} | ||
event-type: update-config-schemas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,4 @@ node_modules | |
/dist | ||
.eslintcache | ||
package-lock.json | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#!/usr/bin/env node | ||
|
||
require('make-promises-safe'); | ||
const explain = require('explain-error'); | ||
const envSchema = require('env-schema'); | ||
const ytSource = require('u-wave-source-youtube'); | ||
const scSource = require('u-wave-source-soundcloud'); | ||
const uwave = require('..'); | ||
const pkg = require('../package.json'); | ||
const argv = require('minimist')(process.argv.slice(2)); | ||
|
||
if (argv.h || argv.help) { | ||
console.log('u-wave-core'); | ||
console.log('Version', pkg.version); | ||
console.log(); | ||
console.log('Environment Variables:'); | ||
console.log(' SECRET'); | ||
console.log(' A secret key used for encrypting passwords. Must be a 64-character hexadecimal string (= 256 bits).'); | ||
console.log(' PORT'); | ||
console.log(' Port to listen on. Defaults to 6042.'); | ||
console.log(' REDIS_URL'); | ||
console.log(' URL of the Redis instance to connect to. Defaults to redis://localhost:6379/.'); | ||
console.log(' MONGODB_URL'); | ||
console.log(' URL of the MongoDB database to use. Defaults to mongodb://localhost:27017/uwave.'); | ||
console.log(); | ||
process.exit(0); | ||
} | ||
|
||
const config = envSchema({ | ||
schema: { | ||
type: 'object', | ||
required: ['SECRET'], | ||
properties: { | ||
PORT: { | ||
type: 'number', | ||
default: 6042, | ||
}, | ||
REDIS_URL: { | ||
type: 'string', | ||
format: 'uri', | ||
default: 'redis://localhost:6379', | ||
}, | ||
MONGODB_URL: { | ||
type: 'string', | ||
format: 'uri', | ||
default: 'mongodb://localhost:27017/uwave', | ||
}, | ||
SECRET: { | ||
type: 'string', | ||
regex: '^[0-9a-fA-F]+$', | ||
min: 64, | ||
max: 64, | ||
}, | ||
YOUTUBE_API_KEY: { | ||
type: 'string', | ||
}, | ||
SOUNDCLOUD_API_KEY: { | ||
type: 'string', | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
const port = Number(argv.port || config.PORT); | ||
|
||
const secret = Buffer.from(config.SECRET, 'hex'); | ||
|
||
const uw = uwave({ | ||
port, | ||
redis: config.REDIS_URL, | ||
mongo: config.MONGODB_URL, | ||
secret, | ||
}); | ||
|
||
uw.express.set('json spaces', 2); | ||
|
||
uw.on('mongoError', (err) => { | ||
throw explain(err, 'Could not connect to MongoDB. Is it installed and running?'); | ||
}); | ||
|
||
uw.on('redisError', (err) => { | ||
throw explain(err, 'Could not connect to the Redis server. Is it installed and running?'); | ||
}); | ||
|
||
if (config.YOUTUBE_API_KEY) { | ||
uw.source(ytSource, { | ||
key: config.YOUTUBE_API_KEY, | ||
}); | ||
} | ||
if (config.SOUNDCLOUD_API_KEY) { | ||
uw.source(scSource, { | ||
key: config.SOUNDCLOUD_API_KEY, | ||
}); | ||
} | ||
|
||
uw.listen(port).then(() => { | ||
console.log(`Now listening on ${port}`); | ||
}, (error) => { | ||
console.error(error.stack); | ||
process.exit(1); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.