mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-12-02 20:28:03 +08:00
replace cookie.js with js-cookie, add js-cookie license (#1561)
* Password verification and v-for add key * DAG automatic layout * combo.js replacement * combo.js replacement * webpack upgrade to 4 * packjson has a file name that has not changed * Solve jertty packing garbled * Modify dashboard color * Remove iconfont, awesome, replace with ans-ui icon * Menu arrow style fix * Script input box style fix * console.log('Front-end third-party js, css introduced using npm * Front-end supplemental license * Modify naming * Repair license * replace cookie.js with js-cookie, add js-cookie license
This commit is contained in:
parent
613e96e570
commit
b4daa85f20
@ -515,6 +515,7 @@ MIT licenses
|
||||
html2canvas 0.5.0-beta4: https://github.com/niklasvh/html2canvas MIT
|
||||
jquery 3.3.1: https://github.com/jquery/jquery MIT
|
||||
jquery-ui 1.12.1: https://github.com/jquery/jquery-ui MIT
|
||||
js-cookie 2.2.1: https://github.com/js-cookie/js-cookie MIT
|
||||
jsplumb 2.8.6: https://github.com/jsplumb/jsplumb MIT and GPLv2
|
||||
lodash 4.17.11: https://github.com/lodash/lodash MIT
|
||||
vue 2.5.17: https://github.com/vuejs/vue MIT
|
||||
|
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Copyright 2018 Klaus Hartl, Fagner Brack, GitHub Contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -23,6 +23,7 @@
|
||||
"html2canvas": "^0.5.0-beta4",
|
||||
"jquery": "3.3.1",
|
||||
"jquery-ui": "^1.12.1",
|
||||
"js-cookie": "^2.2.1",
|
||||
"jsplumb": "^2.8.6",
|
||||
"lodash": "^4.17.11",
|
||||
"vue": "^2.5.17",
|
||||
|
@ -101,7 +101,7 @@
|
||||
<script>
|
||||
import _ from 'lodash'
|
||||
import i18n from '@/module/i18n'
|
||||
import cookie from '@/module/util/cookie'
|
||||
import cookies from 'js-cookie'
|
||||
import mLocalParams from './_source/localParams'
|
||||
import mHttpParams from './_source/httpParams'
|
||||
import mListBox from './_source/listBox'
|
||||
@ -117,7 +117,7 @@
|
||||
httpMethod: 'GET',
|
||||
httpMethodList: [{ code: 'GET' }, { code: 'POST' }, { code: 'HEAD' }, { code: 'PUT' }, { code: 'DELETE' }],
|
||||
httpCheckCondition: 'STATUS_CODE_DEFAULT',
|
||||
httpCheckConditionList: cookie.get('language') == 'en_US'? [{ code: 'STATUS_CODE_DEFAULT',value:'Default response code 200' }, { code: 'STATUS_CODE_CUSTOM',value:'Custom response code' }, { code: 'BODY_CONTAINS',value:'Content includes' }, { code: 'BODY_NOT_CONTAINS',value:'Content does not contain' }]:[{ code: 'STATUS_CODE_DEFAULT',value:'默认响应码200' }, { code: 'STATUS_CODE_CUSTOM',value:'自定义响应码' }, { code: 'BODY_CONTAINS',value:'内容包含' }, { code: 'BODY_NOT_CONTAINS',value:'内容不包含' }]
|
||||
httpCheckConditionList: cookies.get('language') == 'en_US'? [{ code: 'STATUS_CODE_DEFAULT',value:'Default response code 200' }, { code: 'STATUS_CODE_CUSTOM',value:'Custom response code' }, { code: 'BODY_CONTAINS',value:'Content includes' }, { code: 'BODY_NOT_CONTAINS',value:'Content does not contain' }]:[{ code: 'STATUS_CODE_DEFAULT',value:'默认响应码200' }, { code: 'STATUS_CODE_CUSTOM',value:'自定义响应码' }, { code: 'BODY_CONTAINS',value:'内容包含' }, { code: 'BODY_NOT_CONTAINS',value:'内容不包含' }]
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -61,7 +61,7 @@
|
||||
<script>
|
||||
import i18n from '@/module/i18n'
|
||||
import io from '@/module/io'
|
||||
import cookie from '@/module/util/cookie'
|
||||
import cookies from 'js-cookie'
|
||||
|
||||
export default {
|
||||
name: 'login-model',
|
||||
@ -85,7 +85,7 @@
|
||||
setTimeout(() => {
|
||||
this.spinnerLoading = false
|
||||
sessionStorage.setItem("sessionId", res.data)
|
||||
cookie.set('sessionId', res.data,{ path: '/' })
|
||||
cookies.set('sessionId', res.data,{ path: '/' })
|
||||
if (this.userName === 'admin') {
|
||||
window.location.href = `${PUBLIC_PATH}/#/security/tenant`
|
||||
} else {
|
||||
|
@ -151,7 +151,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import _ from 'lodash'
|
||||
import cookie from '@/module/util/cookie'
|
||||
import cookies from 'js-cookie'
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
import { findComponentDownward } from '@/module/util/'
|
||||
import mFileUpdate from '@/module/components/fileUpdate/fileUpdate'
|
||||
@ -276,14 +276,14 @@
|
||||
* Language switching
|
||||
*/
|
||||
_toggleLanguage (language) {
|
||||
cookie.set('language', language, { path: '/' })
|
||||
cookies.set('language', language, { path: '/' })
|
||||
setTimeout(() => {
|
||||
window.location.reload()
|
||||
}, 100)
|
||||
}
|
||||
},
|
||||
created () {
|
||||
let language = cookie.get('language')
|
||||
let language = cookies.get('language')
|
||||
this.activeLocale = language ? findLocale(language) : '中文'
|
||||
this.docLink = process.env.NODE_ENV === 'true' ? 'docs' : `/view/docs/${this.activeLocale.code}/_book` // eslint-disable-line
|
||||
},
|
||||
|
@ -19,7 +19,7 @@
|
||||
import Vue from 'vue'
|
||||
import { findLocale } from './config'
|
||||
import { template } from '@/module/util'
|
||||
import cookie from '@/module/util/cookie'
|
||||
import cookies from 'js-cookie'
|
||||
|
||||
const globalScope = typeof window !== 'undefined' && window.document ? window : global
|
||||
|
||||
@ -44,12 +44,12 @@ const $t = (str, data) => {
|
||||
const locale = (lang) => {
|
||||
// global
|
||||
globalScope.LOCALE = lang
|
||||
// cookie
|
||||
cookie.set('language', lang,{ path: '/' })
|
||||
// cookies
|
||||
cookies.set('language', lang,{ path: '/' })
|
||||
}
|
||||
|
||||
const init = () => {
|
||||
let language = cookie.get('language')
|
||||
let language = cookies.get('language')
|
||||
if (language) {
|
||||
locale(language)
|
||||
}else{
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import io from '@/module/axios/index'
|
||||
import cookie from '@/module/util/cookie'
|
||||
import cookies from 'js-cookie'
|
||||
|
||||
|
||||
const apiPrefix = '/dolphinscheduler'
|
||||
@ -73,7 +73,7 @@ io.interceptors.response.use(
|
||||
// Global request interceptor registion
|
||||
io.interceptors.request.use(
|
||||
config => {
|
||||
let sIdCookie = cookie.get('sessionId')
|
||||
let sIdCookie = cookies.get('sessionId')
|
||||
let sessionId = sessionStorage.getItem("sessionId")
|
||||
let requstUrl = config.url.substring(config.url.lastIndexOf("/")+1)
|
||||
if(requstUrl!=='login' && sIdCookie!=sessionId) {
|
||||
|
@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
let document = window.document
|
||||
let trim = function (s) {
|
||||
if (typeof s !== 'string') {
|
||||
throw new Error('trim need a string as parameter')
|
||||
}
|
||||
let len = s.length, i = 0, j = len - 1, re = /(\u3000|\s|\t|\u00A0)/
|
||||
while (i < len && re.test(s.charAt(i))) ++i
|
||||
while (j >= 0 && re.test(s.charAt(j))) --j
|
||||
return s.substring(i, j + 1)
|
||||
}
|
||||
let copy = function (o) {
|
||||
let d = {}
|
||||
for (let k in o) { if (o.hasOwnProperty(k)) d[k] = o[k] }
|
||||
return d
|
||||
}
|
||||
/**
|
||||
* Cookie setter & setter
|
||||
*
|
||||
* @param {String} name The identify name of cookie.
|
||||
* @param {String} value (Optional) String to set cookie value. (`null` to remove cookie)
|
||||
* @param {Object} options (Optional) Set the cooke native options, (path domain, secure, expires)
|
||||
*/
|
||||
let cookie = function (name, value, options) {
|
||||
options = options || {}
|
||||
if (value !== undefined) { // set cookie
|
||||
options = copy(options)
|
||||
if (value === null) {
|
||||
value = ''
|
||||
options.expires = -1
|
||||
}
|
||||
if (typeof options.expires === 'number') {
|
||||
let days = options.expires, t = options.expires = new Date()
|
||||
t.setTime(t.getTime() + days * 864e+5) // 24 * 60 * 60 * 1000
|
||||
}
|
||||
let encode = function (s) {
|
||||
try {
|
||||
return options.raw ? s : encodeURIComponent(s)
|
||||
} catch (e) {
|
||||
}
|
||||
return s
|
||||
}
|
||||
return (document.cookie = [
|
||||
encode(name), '=', encode(value),
|
||||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
||||
options.path ? '; path=' + options.path : '',
|
||||
options.domain ? '; domain=' + options.domain : '',
|
||||
options.secure ? '; secure' : ''
|
||||
].join(''))
|
||||
} else {
|
||||
let value = null,
|
||||
cookie = document.cookie,
|
||||
decode = function (s) {
|
||||
return options.raw ? s : decodeURIComponent(s)
|
||||
},
|
||||
cookies = cookie ? cookie.split('; ') : []
|
||||
for (let i = -1, l = cookies.length, c = name.length + 1; ++i < l;) {
|
||||
cookie = trim(cookies[i])
|
||||
if (cookie.substring(0, c) === (name + '=')) {
|
||||
value = decode(cookie.substring(c))
|
||||
break
|
||||
}
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
cookie.set = function (k, v, opts) {
|
||||
return cookie(k, v, opts)
|
||||
}
|
||||
cookie.get = function (k) {
|
||||
return cookie(k)
|
||||
}
|
||||
export default cookie
|
Loading…
Reference in New Issue
Block a user