mirror of https://github.com/requarks/wiki
parent
1dcd11570a
commit
405e23f01e
File diff suppressed because one or more lines are too long
@ -0,0 +1,24 @@
|
||||
|
||||
let vueImage = new Vue({
|
||||
el: '#modal-editor-image',
|
||||
data: {
|
||||
modeSelected: 'text'
|
||||
},
|
||||
methods: {
|
||||
cancel: (ev) => {
|
||||
mdeModalOpenState = false;
|
||||
$('#modal-editor-image').slideUp();
|
||||
},
|
||||
insertImage: (ev) => {
|
||||
|
||||
if(mde.codemirror.doc.somethingSelected()) {
|
||||
mde.codemirror.execCommand('singleSelection');
|
||||
}
|
||||
let codeBlockText = '\n```' + vueCodeBlock.modeSelected + '\n' + codeEditor.getValue() + '\n```\n';
|
||||
|
||||
mde.codemirror.doc.replaceSelection(codeBlockText);
|
||||
vueCodeBlock.cancel();
|
||||
|
||||
}
|
||||
}
|
||||
});
|
@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
var _ = require('lodash');
|
||||
|
||||
var validPathRe = new RegExp("^([a-z0-9\\/-]+\\.[a-z0-9]+)$");
|
||||
|
||||
// ==========================================
|
||||
// SERVE UPLOADS FILES
|
||||
// ==========================================
|
||||
|
||||
router.get('/*', (req, res, next) => {
|
||||
|
||||
let fileName = req.params[0];
|
||||
if(!validPathRe.test(fileName)) {
|
||||
return res.sendStatus(404).end();
|
||||
}
|
||||
|
||||
//todo: Authentication-based access
|
||||
|
||||
res.sendFile(fileName, {
|
||||
root: git.getRepoPath() + '/uploads/',
|
||||
dotfiles: 'deny'
|
||||
}, (err) => {
|
||||
if (err) {
|
||||
res.status(err.status).end();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
module.exports = router;
|
Loading…
Reference in new issue