mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-04-26 04:29:11 +00:00
styling: standard.js enforcement.
This commit is contained in:
parent
b8da886601
commit
11cf1d4805
9 changed files with 17 additions and 19 deletions
4
.eslintrc.json
Normal file
4
.eslintrc.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"extends": [ "standard" ],
|
||||||
|
"parser": "babel-eslint"
|
||||||
|
}
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"git.ignoreLimitWarning": true
|
|
||||||
}
|
|
|
@ -72,7 +72,6 @@ module.exports = (R, $) => {
|
||||||
ctx.redirect(url)
|
ctx.redirect(url)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
R.get('/api/oauth/bot/callback', ctx => {
|
R.get('/api/oauth/bot/callback', ctx => {
|
||||||
console.log(ctx.request)
|
console.log(ctx.request)
|
||||||
})
|
})
|
||||||
|
|
|
@ -39,7 +39,7 @@ module.exports = (R, $) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
R.get('/api/server/:id/slug', async (ctx) => {
|
R.get('/api/server/:id/slug', async (ctx) => {
|
||||||
const { userId } = ctx.session
|
// const { userId } = ctx.session
|
||||||
const { id } = ctx.params
|
const { id } = ctx.params
|
||||||
|
|
||||||
const srv = $.discord.client.guilds.get(id)
|
const srv = $.discord.client.guilds.get(id)
|
||||||
|
|
|
@ -3,7 +3,6 @@ module.exports = (R, $) => {
|
||||||
// ctx.body = 'ok'
|
// ctx.body = 'ok'
|
||||||
const srv = $.discord.getRelevantServers(ctx.params.user)
|
const srv = $.discord.getRelevantServers(ctx.params.user)
|
||||||
ctx.body = $.discord.presentableServers(srv, ctx.params.user)
|
ctx.body = $.discord.presentableServers(srv, ctx.params.user)
|
||||||
return
|
|
||||||
})
|
})
|
||||||
|
|
||||||
R.get('/api/~/roles/:id/:userId', (ctx, next) => {
|
R.get('/api/~/roles/:id/:userId', (ctx, next) => {
|
||||||
|
|
|
@ -4,14 +4,14 @@ module.exports = (R, $) => {
|
||||||
const processMappings = mapping => {
|
const processMappings = mapping => {
|
||||||
for (let p in mapping) {
|
for (let p in mapping) {
|
||||||
R.get(p, ctx => {
|
R.get(p, ctx => {
|
||||||
$.ui.render(ctx.req, ctx.res, mapping[p], {...ctx.params, ...ctx.query})
|
return $.ui.render(ctx.req, ctx.res, mapping[p], { ...ctx.query, ...ctx.params })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processMappings({
|
processMappings({
|
||||||
"/s/add": "/_server_add",
|
'/s/add': '/_internal/_server_add',
|
||||||
"/s/:id": "/_server",
|
'/s/:id': '/_internal/_server',
|
||||||
"/help/:page": "/_help"
|
'/test': '/test'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const log = new (require('../logger'))('models/index')
|
const log = new (require('../logger'))('models/index')
|
||||||
const glob = require('glob')
|
const glob = require('glob')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const util = require('../util/model-methods')
|
// const util = require('../util/model-methods')
|
||||||
|
|
||||||
module.exports = (sql) => {
|
module.exports = (sql) => {
|
||||||
const models = {}
|
const models = {}
|
||||||
|
|
|
@ -13,7 +13,7 @@ class DiscordService extends Service {
|
||||||
this.botCallback = `${ctx.config.appUrl}/api/oauth/bot/callback`
|
this.botCallback = `${ctx.config.appUrl}/api/oauth/bot/callback`
|
||||||
this.appUrl = process.env.APP_URL
|
this.appUrl = process.env.APP_URL
|
||||||
this.isBot = process.env.IS_BOT === 'true' || false
|
this.isBot = process.env.IS_BOT === 'true' || false
|
||||||
this.rootUsers = new Set((process.env.ROOT_USERS||'').split(','))
|
this.rootUsers = new Set((process.env.ROOT_USERS || '').split(','))
|
||||||
|
|
||||||
this.client = new discord.Client()
|
this.client = new discord.Client()
|
||||||
this.client.options.disableEveryone = true
|
this.client.options.disableEveryone = true
|
||||||
|
@ -27,11 +27,11 @@ class DiscordService extends Service {
|
||||||
return this.gm(server, this.client.user.id)
|
return this.gm(server, this.client.user.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fakeGm({id = 0, nickname = '[none]', displayHexColor = '#ffffff'}) {
|
fakeGm ({ id = 0, nickname = '[none]', displayHexColor = '#ffffff' }) {
|
||||||
return { id, nickname, displayHexColor, __faked: true, roles: { has() {return false} } }
|
return { id, nickname, displayHexColor, __faked: true, roles: { has () { return false } } }
|
||||||
}
|
}
|
||||||
|
|
||||||
isRoot(id) {
|
isRoot (id) {
|
||||||
return this.rootUsers.has(id)
|
return this.rootUsers.has(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ class DiscordService extends Service {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
// prefix regex with ^ for ease of code
|
// prefix regex with ^ for ease of code
|
||||||
.map(({regex, ...rest}) => ({ regex: new RegExp(`^${regex.source}`, regex.flags), ...rest }))
|
.map(({ regex, ...rest }) => ({ regex: new RegExp(`^${regex.source}`, regex.flags), ...rest }))
|
||||||
|
|
||||||
return cmds
|
return cmds
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,6 @@ class DiscordService extends Service {
|
||||||
async handleJoin (guild) {
|
async handleJoin (guild) {
|
||||||
await this.ctx.server.ensure(guild)
|
await this.ctx.server.ensure(guild)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = DiscordService
|
module.exports = DiscordService
|
||||||
|
|
|
@ -6,7 +6,7 @@ class SessionsService extends Service {
|
||||||
this.Session = ctx.M.Session
|
this.Session = ctx.M.Session
|
||||||
}
|
}
|
||||||
|
|
||||||
async get (id, {rolling}) {
|
async get (id, { rolling }) {
|
||||||
const user = await this.Session.findOne({ where: { id } })
|
const user = await this.Session.findOne({ where: { id } })
|
||||||
|
|
||||||
if (user === null) {
|
if (user === null) {
|
||||||
|
@ -16,7 +16,7 @@ class SessionsService extends Service {
|
||||||
return user.data
|
return user.data
|
||||||
}
|
}
|
||||||
|
|
||||||
async set (id, data, {maxAge, rolling, changed}) {
|
async set (id, data, { maxAge, rolling, changed }) {
|
||||||
let session = await this.Session.findOne({ where: { id } })
|
let session = await this.Session.findOne({ where: { id } })
|
||||||
if (session === null) {
|
if (session === null) {
|
||||||
session = this.Session.build({ id })
|
session = this.Session.build({ id })
|
||||||
|
|
Loading…
Add table
Reference in a new issue