mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 03:27:05 -04: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
|
@ -12,14 +12,16 @@ import {
|
|||
urlpath
|
||||
} from './lib/config'
|
||||
|
||||
var jsUrl = require('js-url')
|
||||
|
||||
window.migrateHistoryFromTempCallback = null
|
||||
|
||||
migrateHistoryFromTemp()
|
||||
|
||||
function migrateHistoryFromTemp () {
|
||||
if (window.url('#tempid')) {
|
||||
if (jsUrl('#tempid')) {
|
||||
$.get(`${serverurl}/temp`, {
|
||||
tempid: window.url('#tempid')
|
||||
tempid: jsUrl('#tempid')
|
||||
})
|
||||
.done(data => {
|
||||
if (data && data.temp) {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
modeType, Idle, serverurl, key, gapi, Dropbox, FilePicker
|
||||
ot, MediaUploader, hex2rgb, num_loaded, Visibility */
|
||||
|
||||
|
||||
require('../vendor/showup/showup')
|
||||
|
||||
require('../css/index.css')
|
||||
|
@ -21,6 +22,8 @@ import _ from 'lodash'
|
|||
|
||||
import List from 'list.js'
|
||||
|
||||
var jsUrl = require('js-url')
|
||||
|
||||
import {
|
||||
checkLoginStateChanged,
|
||||
setloginStateChangeEvent
|
||||
|
@ -1474,12 +1477,12 @@ $('#gistImportModalConfirm').click(function () {
|
|||
if (!isValidURL(gisturl)) {
|
||||
showMessageModal('<i class="fa fa-github"></i> Import from Gist', 'Not a valid URL :(', '', '', false)
|
||||
} else {
|
||||
var hostname = window.url('hostname', gisturl)
|
||||
var hostname = jsUrl('hostname', gisturl)
|
||||
if (hostname !== 'gist.github.com') {
|
||||
showMessageModal('<i class="fa fa-github"></i> Import from Gist', 'Not a valid Gist URL :(', '', '', false)
|
||||
} else {
|
||||
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) {
|
||||
if (data.files) {
|
||||
var contents = ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue