mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 03:06:31 -05:00
Load js-url lib using legacy-loader
Doesn't use eval, plus no window object access
This commit is contained in:
parent
996cb37991
commit
5b83deb043
4 changed files with 17 additions and 7 deletions
|
@ -56,6 +56,7 @@
|
||||||
"js-yaml": "^3.7.0",
|
"js-yaml": "^3.7.0",
|
||||||
"jsdom-nogyp": "^0.8.3",
|
"jsdom-nogyp": "^0.8.3",
|
||||||
"keymaster": "^1.6.2",
|
"keymaster": "^1.6.2",
|
||||||
|
"legacy-loader": "0.0.2",
|
||||||
"list.js": "^1.5.0",
|
"list.js": "^1.5.0",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"lz-string": "1.4.4",
|
"lz-string": "1.4.4",
|
||||||
|
|
|
@ -12,14 +12,16 @@ import {
|
||||||
urlpath
|
urlpath
|
||||||
} from './lib/config'
|
} from './lib/config'
|
||||||
|
|
||||||
|
var jsUrl = require('js-url')
|
||||||
|
|
||||||
window.migrateHistoryFromTempCallback = null
|
window.migrateHistoryFromTempCallback = null
|
||||||
|
|
||||||
migrateHistoryFromTemp()
|
migrateHistoryFromTemp()
|
||||||
|
|
||||||
function migrateHistoryFromTemp () {
|
function migrateHistoryFromTemp () {
|
||||||
if (window.url('#tempid')) {
|
if (jsUrl('#tempid')) {
|
||||||
$.get(`${serverurl}/temp`, {
|
$.get(`${serverurl}/temp`, {
|
||||||
tempid: window.url('#tempid')
|
tempid: jsUrl('#tempid')
|
||||||
})
|
})
|
||||||
.done(data => {
|
.done(data => {
|
||||||
if (data && data.temp) {
|
if (data && data.temp) {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
modeType, Idle, serverurl, key, gapi, Dropbox, FilePicker
|
modeType, Idle, serverurl, key, gapi, Dropbox, FilePicker
|
||||||
ot, MediaUploader, hex2rgb, num_loaded, Visibility */
|
ot, MediaUploader, hex2rgb, num_loaded, Visibility */
|
||||||
|
|
||||||
|
|
||||||
require('../vendor/showup/showup')
|
require('../vendor/showup/showup')
|
||||||
|
|
||||||
require('../css/index.css')
|
require('../css/index.css')
|
||||||
|
@ -21,6 +22,8 @@ import _ from 'lodash'
|
||||||
|
|
||||||
import List from 'list.js'
|
import List from 'list.js'
|
||||||
|
|
||||||
|
var jsUrl = require('js-url')
|
||||||
|
|
||||||
import {
|
import {
|
||||||
checkLoginStateChanged,
|
checkLoginStateChanged,
|
||||||
setloginStateChangeEvent
|
setloginStateChangeEvent
|
||||||
|
@ -1474,12 +1477,12 @@ $('#gistImportModalConfirm').click(function () {
|
||||||
if (!isValidURL(gisturl)) {
|
if (!isValidURL(gisturl)) {
|
||||||
showMessageModal('<i class="fa fa-github"></i> Import from Gist', 'Not a valid URL :(', '', '', false)
|
showMessageModal('<i class="fa fa-github"></i> Import from Gist', 'Not a valid URL :(', '', '', false)
|
||||||
} else {
|
} else {
|
||||||
var hostname = window.url('hostname', gisturl)
|
var hostname = jsUrl('hostname', gisturl)
|
||||||
if (hostname !== 'gist.github.com') {
|
if (hostname !== 'gist.github.com') {
|
||||||
showMessageModal('<i class="fa fa-github"></i> Import from Gist', 'Not a valid Gist URL :(', '', '', false)
|
showMessageModal('<i class="fa fa-github"></i> Import from Gist', 'Not a valid Gist URL :(', '', '', false)
|
||||||
} else {
|
} else {
|
||||||
ui.spinner.show()
|
ui.spinner.show()
|
||||||
$.get('https://api.github.com/gists/' + window.url('-1', gisturl))
|
$.get('https://api.github.com/gists/' + jsUrl('-1', gisturl))
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
if (data.files) {
|
if (data.files) {
|
||||||
var contents = ''
|
var contents = ''
|
||||||
|
|
|
@ -190,7 +190,7 @@ module.exports = {
|
||||||
index: [
|
index: [
|
||||||
'babel-polyfill',
|
'babel-polyfill',
|
||||||
'script!jquery-ui-resizable',
|
'script!jquery-ui-resizable',
|
||||||
'script!js-url',
|
'js-url',
|
||||||
'expose?filterXSS!xss',
|
'expose?filterXSS!xss',
|
||||||
'script!Idle.Js',
|
'script!Idle.Js',
|
||||||
'expose?LZString!lz-string',
|
'expose?LZString!lz-string',
|
||||||
|
@ -241,7 +241,7 @@ module.exports = {
|
||||||
'expose?jsyaml!js-yaml',
|
'expose?jsyaml!js-yaml',
|
||||||
'script!mermaid',
|
'script!mermaid',
|
||||||
'expose?moment!moment',
|
'expose?moment!moment',
|
||||||
'script!js-url',
|
'js-url',
|
||||||
'script!handlebars',
|
'script!handlebars',
|
||||||
'expose?hljs!highlight.js',
|
'expose?hljs!highlight.js',
|
||||||
'expose?emojify!emojify.js',
|
'expose?emojify!emojify.js',
|
||||||
|
@ -374,7 +374,8 @@ module.exports = {
|
||||||
'bootstrap-tooltip': path.join(__dirname, 'public/vendor/bootstrap/tooltip.min.js'),
|
'bootstrap-tooltip': path.join(__dirname, 'public/vendor/bootstrap/tooltip.min.js'),
|
||||||
'headjs': path.join(__dirname, 'node_modules/reveal.js/lib/js/head.min.js'),
|
'headjs': path.join(__dirname, 'node_modules/reveal.js/lib/js/head.min.js'),
|
||||||
'reveal-markdown': path.join(__dirname, 'public/js/reveal-markdown.js'),
|
'reveal-markdown': path.join(__dirname, 'public/js/reveal-markdown.js'),
|
||||||
abcjs: path.join(__dirname, 'public/vendor/abcjs_basic_3.1.1-min.js')
|
abcjs: path.join(__dirname, 'public/vendor/abcjs_basic_3.1.1-min.js'),
|
||||||
|
'js-url': path.join(__dirname, 'node_modules/js-url/url.js')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -429,6 +430,9 @@ module.exports = {
|
||||||
}, {
|
}, {
|
||||||
test: /\.gif(\?v=\d+\.\d+\.\d+)?$/,
|
test: /\.gif(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
loader: 'url?limit=10000&mimetype=image/gif'
|
loader: 'url?limit=10000&mimetype=image/gif'
|
||||||
|
}, {
|
||||||
|
test: /\/node_modules\/js-url\/url.js/,
|
||||||
|
loader: 'legacy'
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
node: {
|
node: {
|
||||||
|
|
Loading…
Reference in a new issue