Commit db14239e authored by Nick's avatar Nick

feat: dropbox auth module + uploads folder boot fix

parent 9b8a8867
......@@ -262,18 +262,6 @@ export default {
})
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) {
return moment.duration(val).format('y [years], M [months], d [days], h [hours], m [minutes]')
},
......
......@@ -10,6 +10,7 @@ module.exports = async () => {
try {
const uplTempPath = path.resolve(process.cwd(), WIKI.config.paths.data, 'uploads')
await fs.ensureDir(uplTempPath)
const ls = await fs.readdir(uplTempPath)
const fifteenAgo = moment().subtract(15, 'minutes')
......
......@@ -5,6 +5,7 @@
// ------------------------------------
const DropboxStrategy = require('passport-dropbox-oauth2').Strategy
const _ = require('lodash')
module.exports = {
init (passport, conf) {
......@@ -14,12 +15,20 @@ module.exports = {
clientID: conf.clientId,
clientSecret: conf.clientSecret,
callbackURL: conf.callbackURL
}, (accessToken, refreshToken, profile, cb) => {
WIKI.models.users.processProfile(profile).then((user) => {
return cb(null, user) || true
}).catch((err) => {
return cb(err, null) || true
})
}, async (accessToken, refreshToken, profile, cb) => {
console.info(profile)
try {
const user = await WIKI.models.users.processProfile({
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
color: blue darken-2
website: https://dropbox.com
isAvailable: true
useForm: false
props:
clientId: String
clientSecret: String
clientId:
type: String
title: App Key
hint: Application Client ID
order: 1
clientSecret:
type: String
title: App Secret
hint: Application Client Secret
order: 2
This diff was suppressed by a .gitattributes entry.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment