更新git及依赖

v1
宇天 2020-09-16 14:08:06 +08:00
parent f595a927ce
commit 3d7963e6f5
12 changed files with 18 additions and 35 deletions

View File

@ -10,7 +10,7 @@
const smarty = new libs.Smarty()
const jwt = require('./module/jwt')
class Controller {
export default class Controller {
constructor({ ctx, req, res }) {
this.ctx = ctx
this.name = req.app
@ -75,5 +75,3 @@ class Controller {
this.response.append('X-debug', msg + '')
}
}
module.exports = Controller

View File

@ -5,9 +5,9 @@
* @version $Id$
*/
const Cookie = require('http.cookie')
import Cookie from 'http.cookie'
module.exports = function(req, res, next) {
export default function(req, res, next) {
var cookie = new Cookie(req.origin.req, req.origin.res)
var domain = this.get('domain')
this.__INSTANCE__.cookie = function(key, val, opt) {

View File

@ -6,7 +6,7 @@
'use strict'
module.exports = function(req, res, next) {
export default function(req, res, next) {
var supportCredentials = this.get('supportCredentials')
var credentialsRule = this.get('credentialsRule')
var credentialsMaxAge = this.get('credentialsMaxAge')

View File

@ -6,7 +6,7 @@
*/
'use strict'
module.exports = function(req, res, next) {
export default function(req, res, next) {
if (!this.__MODULES__[req.app]) {
if (!this.__MODULES__.__error__) {
res.error(`The app [${req.app}] not found`, 404)

View File

@ -4,10 +4,10 @@
* @date 2018-07-26 15:50:25
* @version $Id$
*/
const redisStore = require('../module/redis-store')
const nativeStore = require('../module/native-store')
import redisStore from '../module/redis-store'
import nativeStore from '../module/native-store'
module.exports = function(req, res, next) {
export default function(req, res, next) {
var opt = this.get('session')
var jwt = this.get('jwt')
var cookie = this.ins('cookie')

View File

@ -15,7 +15,7 @@ const sha256 = (str, secret) => {
.replace(/=/g, '')
}
const sign = function(token) {
export const sign = function(token) {
// "{"typ":"JWT","alg":"HS256"}"
// 这里固定使用sha256
var header = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9'
@ -31,7 +31,7 @@ const sign = function(token) {
return `${header}.${payload}.${auth}`
}
const verify = function() {
export const verify = function() {
var jwt = this.request.header('authorization') || ''
var secret = this.ctx.get('jwt')
var auth, token, payload
@ -56,8 +56,3 @@ const verify = function() {
}
return false
}
module.exports = {
verify,
sign
}

View File

@ -6,7 +6,7 @@
*/
'use strict'
class Log {
export default class Log {
constructor(file = 'run_time.log', dir) {
if (!dir) {
throw new Error(`agument dir must be a string, but ${typeof dir} given.`)
@ -44,5 +44,3 @@ class Log {
)
}
}
module.exports = Log

View File

@ -15,7 +15,7 @@ function hideProperty(host, name, value) {
})
}
class Session {
export default class Session {
constructor(store, opt, uuid) {
this.opt = opt
this.uuid = uuid
@ -79,5 +79,3 @@ class Session {
this.store[this.ssid] = {}
}
}
module.exports = Session

View File

@ -6,7 +6,7 @@
*/
'use strict'
class Session {
export default class Session {
constructor(store, opt, uuid) {
this.store = store
this.opt = opt
@ -79,5 +79,3 @@ class Session {
this.store.del(this.ssid)
}
}
module.exports = Session

View File

@ -7,7 +7,7 @@
'use strict'
const mailx = require('mailx')
class Sendmail {
export default class Sendmail {
constructor({ host, port, mail, passwd } = {}) {
if (!host || !port || !mail || !passwd) {
throw new Error('smtp options [host, port, mail, passwd] is required.')
@ -44,5 +44,3 @@ class Sendmail {
return defer.promise
}
}
module.exports = Sendmail

View File

@ -7,7 +7,7 @@
'use strict'
const init = {
export default {
db: {},
session: {
type: 'native', // native 或 redis
@ -48,5 +48,3 @@ const init = {
qq: /^\d{5,12}$/
}
}
module.exports = init

View File

@ -7,7 +7,7 @@
"main": "index.js",
"dependencies": {
"crypto.js": "^1.3.1",
"es.shim": "^1.1.2",
"@bytedo/es.shim": "^1.0.0",
"iofs": "^1.3.2",
"mysqli": "^3.0.11",
"http.request": "^1.1.0",
@ -20,11 +20,11 @@
"devDependencies": {},
"repository": {
"type": "git",
"url": "https://github.com/yutent/five.git"
"url": "https://github.com/bytedo/gmf.core.git"
},
"keywords": ["five, fivejs, node-five, five.js, nodejs, mvc, koa, express"],
"engines": {
"node": ">=8.0.0"
"node": ">=10.0.0"
},
"license": "MIT"
}