diff --git a/build.sh b/build.sh index f1de076..3e2dfb3 100755 --- a/build.sh +++ b/build.sh @@ -6,12 +6,12 @@ mkdir -p dist/chrome cp -r _locales css fonts img js LICENSE manifest.json *.html dist/chrome cd dist/chrome -rm js/libs/vue.js +rm -f js/libs/vue.js # 将 vue.js 替换为 vue.min.js html_file=`ls *.html` -for html in $html_file;do +for html in $html_file; do sed -i 's/src="js\/libs\/vue.js"/src="js\/libs\/vue.min.js"/' $html done zip -r ../jenkins-helper.zip * -cd - \ No newline at end of file +cd - diff --git a/js/params.js b/js/params.js index 9670af4..d275ef8 100644 --- a/js/params.js +++ b/js/params.js @@ -62,7 +62,8 @@ new Vue({ getParametersByUrl(url) { var _self = this; var jsonUrl = url + '/api/json'; - fetch(jsonUrl).then(function (res) { + // console.log("jsonUrl", jsonUrl); + fetch(jsonUrl, Tools.getDefaultFetchOption()).then(function (res) { if (res.ok) { return res.json(); } else { diff --git a/js/tools.js b/js/tools.js index 01819b9..066bade 100644 --- a/js/tools.js +++ b/js/tools.js @@ -5,6 +5,15 @@ var Tools = (function () { jenkinsTokens = tokens } + function getDefaultFetchOption(method = 'GET') { + return { + method: method, + credentials: 'include', + mode: 'cors', + redirect: 'follow', + } + } + function getFetchOption(url, method = 'GET') { // console.log('jenkinsTokens', jenkinsTokens); var token = undefined; @@ -25,17 +34,13 @@ var Tools = (function () { }) } } else { - return { - method: method, - credentials: 'include', - mode: 'cors', - redirect: 'follow', - } + return getDefaultFetchOption(method) } } return { setJenkinsTokens, + getDefaultFetchOption, getFetchOption } })(); diff --git a/manifest.json b/manifest.json index b20fb0a..7f41297 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "description": "__MSG_pluginDesc__", "author": "LiYing", "homepage_url": "https://github.com/liying2008/jenkins-helper", - "version": "1.1.6", + "version": "1.1.7", "minimum_chrome_version": "45", "default_locale": "en", "omnibox": { diff --git a/params.html b/params.html index 23ca491..c3266da 100644 --- a/params.html +++ b/params.html @@ -104,4 +104,5 @@