base: Add feature flag for making articles api private
Some checks failed
/ deploy (push) Failing after -75h28m39s
Some checks failed
/ deploy (push) Failing after -75h28m39s
This commit is contained in:
parent
d1730974dc
commit
a5c7e53802
2 changed files with 12 additions and 1 deletions
|
@ -8,11 +8,14 @@ export default class ArticleRoutes {
|
|||
uploadMedia: uploadMedia,
|
||||
uploadFile: uploadFile,
|
||||
deleteFile: deleteFile,
|
||||
requireAuth: opts.requireAuth,
|
||||
})
|
||||
}
|
||||
|
||||
register(server) {
|
||||
if (!this.requireAuth) {
|
||||
server.flaska.get('/api/articles/:path', this.getArticle.bind(this))
|
||||
}
|
||||
server.flaska.get('/api/auth/articles', server.authenticate(), this.auth_getAllArticles.bind(this))
|
||||
server.flaska.get('/api/auth/articles/:id', server.authenticate(), this.auth_getSingleArticle.bind(this))
|
||||
server.flaska.put('/api/auth/articles/:id', [
|
||||
|
@ -111,6 +114,10 @@ export default class ArticleRoutes {
|
|||
)
|
||||
}
|
||||
|
||||
if (ctx.req.body.media && ctx.req.body.media.filename && ctx.req.body.media.type && ctx.req.body.media.path && ctx.req.body.media.size) {
|
||||
newMedia = ctx.req.body.media
|
||||
}
|
||||
|
||||
await Promise.all(promises)
|
||||
|
||||
return this.private_getUpdateArticle(ctx, ctx.req.body, newBanner, newMedia)
|
||||
|
|
|
@ -98,6 +98,10 @@ export default class Client {
|
|||
}
|
||||
|
||||
createJwt(body, secret) {
|
||||
return Client.createJwt(body, secret)
|
||||
}
|
||||
|
||||
static createJwt(body, secret) {
|
||||
let header = {
|
||||
typ: 'JWT',
|
||||
alg: 'HS256',
|
||||
|
|
Loading…
Reference in a new issue