fixes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
choelzl 2021-07-16 12:02:23 +02:00
parent f42e57a3b3
commit dbf93d8d1f
Signed by: sora
GPG Key ID: A362EA0491E2EEA0
3 changed files with 5 additions and 45 deletions

View File

@ -1,36 +0,0 @@
'use strict'
const fp = require('fastify-plugin')
const levelup = require('levelup')
const leveldown = require('leveldown')
const encode = require('encoding-down')
// mostly from level-packager
const levelMore = (location) => {
;['destroy', 'repair'].forEach(function (m) {
if (typeof leveldown[m] === 'function') {
levelMore[m] = () => leveldown[m].apply(leveldown, arguments)
}
})
return levelup(encode(leveldown(location), { }), { })
}
levelMore.errors = levelup.errors
function levelPlugin (fastify, opt, next) {
fastify
.decorate('lauth', levelMore('auth'))
.addHook('onClose', close)
next()
}
function close (fastify, done) {
fastify.level.close(done)
}
module.exports = fp(levelPlugin, {
fastify: '>=1.0.0',
name: 'level_auth'
});

View File

@ -14,11 +14,11 @@
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.21.1",
"axios": "latest",
"fastify": "latest",
"fastify-leveldb": "latest",
"fastify-static": "^2.5.0",
"mkdirp": "^1.0.4",
"node-sass": "^6.0.0"
"fastify-static": "latest",
"mkdirp": "latest",
"node-sass": "latest"
}
}

View File

@ -20,10 +20,7 @@ fastify.register(require('fastify-leveldb'), {
fastify.get('/', (req, reply) => {
reply.sendFile('/template/home.html');
});
fastify.get('/dbg', (req, reply) => {
reply.sendFile('/template/templates.html');
});
fastify.register(require('./router/api'), { prefix: '/api' });
fastify.get('/:id', (req, reply) => {
try{
@ -49,7 +46,6 @@ fastify.get('/:id', (req, reply) => {
});
fastify.register(require('./router/api'), { prefix: '/api' });
fastify.listen(8080,'0.0.0.0' ,(err,address) => {