feat: dropbox auth module + uploads folder boot fix
This commit is contained in:
@@ -262,18 +262,6 @@ export default {
|
|||||||
})
|
})
|
||||||
this.$store.commit(`loadingStop`, 'admin-storage-savetargets')
|
this.$store.commit(`loadingStop`, 'admin-storage-savetargets')
|
||||||
},
|
},
|
||||||
getStatusColor(state) {
|
|
||||||
switch (state) {
|
|
||||||
case 'pending':
|
|
||||||
return 'purple lighten-2'
|
|
||||||
case 'operational':
|
|
||||||
return 'green'
|
|
||||||
case 'error':
|
|
||||||
return 'red'
|
|
||||||
default:
|
|
||||||
return 'grey darken-2'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getDefaultSchedule(val) {
|
getDefaultSchedule(val) {
|
||||||
return moment.duration(val).format('y [years], M [months], d [days], h [hours], m [minutes]')
|
return moment.duration(val).format('y [years], M [months], d [days], h [hours], m [minutes]')
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ module.exports = async () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const uplTempPath = path.resolve(process.cwd(), WIKI.config.paths.data, 'uploads')
|
const uplTempPath = path.resolve(process.cwd(), WIKI.config.paths.data, 'uploads')
|
||||||
|
await fs.ensureDir(uplTempPath)
|
||||||
const ls = await fs.readdir(uplTempPath)
|
const ls = await fs.readdir(uplTempPath)
|
||||||
const fifteenAgo = moment().subtract(15, 'minutes')
|
const fifteenAgo = moment().subtract(15, 'minutes')
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
|
|
||||||
const DropboxStrategy = require('passport-dropbox-oauth2').Strategy
|
const DropboxStrategy = require('passport-dropbox-oauth2').Strategy
|
||||||
|
const _ = require('lodash')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
init (passport, conf) {
|
init (passport, conf) {
|
||||||
@@ -14,12 +15,20 @@ module.exports = {
|
|||||||
clientID: conf.clientId,
|
clientID: conf.clientId,
|
||||||
clientSecret: conf.clientSecret,
|
clientSecret: conf.clientSecret,
|
||||||
callbackURL: conf.callbackURL
|
callbackURL: conf.callbackURL
|
||||||
}, (accessToken, refreshToken, profile, cb) => {
|
}, async (accessToken, refreshToken, profile, cb) => {
|
||||||
WIKI.models.users.processProfile(profile).then((user) => {
|
console.info(profile)
|
||||||
return cb(null, user) || true
|
try {
|
||||||
}).catch((err) => {
|
const user = await WIKI.models.users.processProfile({
|
||||||
return cb(err, null) || true
|
profile: {
|
||||||
})
|
...profile,
|
||||||
|
picture: _.get(profile, '_json.profile_photo_url', '')
|
||||||
|
},
|
||||||
|
providerKey: 'dropbox'
|
||||||
|
})
|
||||||
|
cb(null, user)
|
||||||
|
} catch (err) {
|
||||||
|
cb(err, null)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,16 @@ author: requarks.io
|
|||||||
logo: https://static.requarks.io/logo/dropbox.svg
|
logo: https://static.requarks.io/logo/dropbox.svg
|
||||||
color: blue darken-2
|
color: blue darken-2
|
||||||
website: https://dropbox.com
|
website: https://dropbox.com
|
||||||
|
isAvailable: true
|
||||||
useForm: false
|
useForm: false
|
||||||
props:
|
props:
|
||||||
clientId: String
|
clientId:
|
||||||
clientSecret: String
|
type: String
|
||||||
|
title: App Key
|
||||||
|
hint: Application Client ID
|
||||||
|
order: 1
|
||||||
|
clientSecret:
|
||||||
|
type: String
|
||||||
|
title: App Secret
|
||||||
|
hint: Application Client Secret
|
||||||
|
order: 2
|
||||||
|
|||||||
Reference in New Issue
Block a user