diff --git a/.eslintrc.json b/.eslintrc.json
index f2d6a6a3..c1213839 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -8,7 +8,41 @@
}
},
"rules": {
- "semi": 2
+ "semi": 2,
+ "quotes": 0,
+ "strict": 0,
+ "padding-line-between-statements": 0,
+ "spaced-comment": 0,
+ "no-console": 0,
+ "comma-dangle": 0,
+ "no-unneeded-ternary": 0,
+ "space-before-function-paren": 0,
+ "indent": 0,
+ "curly": 0,
+ "no-unused-vars": 0,
+ "guard-for-in": 0,
+ "radix": 0,
+ "no-param-reassign": 0,
+ "no-else-return": 0,
+ "eqeqeq": 0,
+ "dot-notation": 0,
+ "object-curly-newline": 0,
+ "operator-assignment": 0,
+ "no-shadow": 0,
+ "require-atomic-updates": 0,
+ "nonblock-statement-body-position": 0,
+ "no-empty": 0,
+ "no-lonely-if": 0,
+ "one-var": 0,
+ "block-scoped-var": 0,
+ "no-redeclare": 0,
+ "no-useless-return": 0,
+ "no-loop-func": 0,
+ "default-case": 0,
+ "no-fallthrough": 0,
+ "prefer-promise-reject-errors": 0,
+ "no-throw-literal": 0,
+ "brace-style": 0
},
"extends": ["@alicloud/eslint-config/es5"],
"ignorePatterns": ["static/", "vendor/", "dist/", "node_modules/", "test/"],
diff --git a/app/components/filters/formater.js b/app/components/filters/formater.js
index 5fc2d0e5..2195b853 100644
--- a/app/components/filters/formater.js
+++ b/app/components/filters/formater.js
@@ -1,4 +1,3 @@
-
angular
.module('web')
.filter('trustAsResourceUrl', [
diff --git a/app/components/filters/list-filter.js b/app/components/filters/list-filter.js
index a0bd4b30..e692d39b 100644
--- a/app/components/filters/list-filter.js
+++ b/app/components/filters/list-filter.js
@@ -1,4 +1,3 @@
-
angular.module('web').filter('listFilter', function() {
return function(arr, keyFn, value) {
if (!value) { return arr; }
diff --git a/app/components/services/cipher.js b/app/components/services/cipher.js
index f720f04a..0f3e808a 100644
--- a/app/components/services/cipher.js
+++ b/app/components/services/cipher.js
@@ -9,7 +9,7 @@ angular.module('web').factory('Cipher', function() {
};
function cipher(buf, key, algorithm) {
- if (!buf instanceof Buffer) {
+ if (!(buf instanceof Buffer)) {
buf = new Buffer(buf);
}
diff --git a/app/components/services/diff-modal.js b/app/components/services/diff-modal.js
index ab02ef10..fa13344d 100644
--- a/app/components/services/diff-modal.js
+++ b/app/components/services/diff-modal.js
@@ -1,4 +1,3 @@
-
angular
.module('web')
.factory('DiffModal', [
diff --git a/app/components/services/oss-download-manager.js b/app/components/services/oss-download-manager.js
index a30e36ea..137841f1 100644
--- a/app/components/services/oss-download-manager.js
+++ b/app/components/services/oss-download-manager.js
@@ -259,6 +259,7 @@ angular.module('web').factory('ossDownloadManager', [
// 文件
if (process.platform == 'win32') {
// 修复window下,文件名含非法字符需要转义
+ // eslint-disable-next-line no-useless-escape
if (/[\/\\\:\<\>\?\*\"\|]/.test(fileName)) {
fileName = encodeURIComponent(fileName);
filePath = path.join(
diff --git a/app/components/services/oss-upload-manager.js b/app/components/services/oss-upload-manager.js
index 31b9dfb5..06fb5da3 100644
--- a/app/components/services/oss-upload-manager.js
+++ b/app/components/services/oss-upload-manager.js
@@ -367,13 +367,13 @@ angular.module('web').factory('ossUploadManager', [
from: n.from,
status: n.status,
message: n.message,
+ ecCode: n.ecCode,
+ requestId: n.requestId,
prog: n.prog
});
});
// console.log('request save upload:', t);
-
- // console.log('-save')
fs.writeFileSync(getUpProgFilePath(), JSON.stringify(t));
$scope.calcTotalProg();
},
diff --git a/app/components/services/oss2.js b/app/components/services/oss2.js
index c05905e6..c55dbf67 100644
--- a/app/components/services/oss2.js
+++ b/app/components/services/oss2.js
@@ -1,3 +1,4 @@
+/* eslint-disable no-unexpected-multiline */
angular.module('web').factory('ossSvs2', [
'$q',
'$rootScope',
@@ -245,6 +246,7 @@ angular.module('web').factory('ossSvs2', [
if (i.status === 'fulfilled') {
fulfilled.push(i.value);
} else {
+ // eslint-disable-next-line no-unused-expressions
i.status === 'rejected';
if (Array.isArray(i.reason)) {
@@ -1200,14 +1202,15 @@ angular.module('web').factory('ossSvs2', [
if (taggingResult && taggingResult.tag) {
tagging = Object.keys(taggingResult.tag).map(function(k) {
+ // eslint-disable-next-line no-undef
return encodeURIComponent(k) + '=' + encodeURIComponent(data[k]);
}).join('&');
}
let encoding = headResult.ContentEncoding;
// code-modal保存时,如果encoding=gzip,就不变更gzip,避免内容未做gzip压缩,导致sdk中的urllib响应内容解析失败
- if(isCodeSave && encoding === 'gzip'){
- encoding=undefined;
+ if (isCodeSave && encoding === 'gzip') {
+ encoding = undefined;
}
client3.put(key, new Buffer(content), {
@@ -1611,7 +1614,9 @@ angular.module('web').factory('ossSvs2', [
});
}
- function _listFilesOrigion(region, bucket, key, marker = '', length = 1000) {
+ function _listFilesOrigion(region, bucket, key, marker = '', length) {
+ if (!length) length = localStorage.getItem("listObjectNum") || 500;
+ console.log('list-object-max-length', length);
const client = getClient3({
region,
bucket
@@ -1689,51 +1694,6 @@ angular.module('web').factory('ossSvs2', [
list(marker);
});
-
- return client.listV2(Object.assign({}, options, { 'continuation-token': marker }))
- .then((resp) => {
- const dirs = (resp.prefixes || [])
- .filter((n) => n !== key)
- .map((n) => {
- const arr = n.split('/').filter((k) => !!k);
- const name = arr[arr.length - 1];
-
- return {
- isFolder: true,
- itemType: 'folder',
- path: n,
- name: name === '/' ? name : name.replace(/\/$/, '')
- };
- });
- const objects = (resp.objects || [])
- .filter((n) => n.name !== key)
- .map((n) => {
- const arr = n.name.split('/').filter((k) => !!k);
- const name = arr[arr.length - 1];
-
- return Object.assign(n, {
- isFile: true,
- itemType: 'file',
- path: n.name,
- name: name
- });
- });
-
- return {
- data: {
- dirs,
- objects
- },
- marker: resp.nextContinuationToken,
- truncated: resp.isTruncated,
- maxKeys: +resp.keyCount
- };
- })
- ['catch']((e) => {
- handleError(e);
-
- return Promise.reject(e);
- });
}
function listAllFiles(region, bucket, key, folderOnly) {
@@ -1997,7 +1957,7 @@ angular.module('web').factory('ossSvs2', [
}
return (
- protocol + '//' + bucket + '.' + region + '.aliyuncs.com' + '/' + key
+ protocol + '//' + bucket + '.' + region + '.aliyuncs.com/' + key
);
}
@@ -2018,7 +1978,7 @@ angular.module('web').factory('ossSvs2', [
}
return (
- protocol + '//' + bucket + '.' + region + '.aliyuncs.com' + '/' + key
+ protocol + '//' + bucket + '.' + region + '.aliyuncs.com/' + key
);
}
diff --git a/app/components/services/settings.js b/app/components/services/settings.js
index f2ef0896..3d689496 100644
--- a/app/components/services/settings.js
+++ b/app/components/services/settings.js
@@ -112,6 +112,16 @@ angular.module('web').factory('settingsSvs', [
return localStorage.setItem('downloadConcurrecyPartSize', v);
}
},
+ listObjectNum: {
+ get: function() {
+ return parseInt(
+ localStorage.getItem('listObjectNum') || 500
+ );
+ },
+ set: function(v) {
+ return localStorage.setItem('listObjectNum', v);
+ }
+ },
uploadAndDownloadRetryTimes: {
get: function() {
return parseInt(
diff --git a/app/main/files/files.js b/app/main/files/files.js
index 357d91e2..68e0e5a8 100644
--- a/app/main/files/files.js
+++ b/app/main/files/files.js
@@ -648,6 +648,7 @@ angular
function(result) {
const arr = result.data;
+ // eslint-disable-next-line no-unused-expressions
settingsSvs.showImageSnapshot.get() == 1
? signPicURL(info, arr)
: null;
@@ -726,8 +727,7 @@ angular
`)
);
safeApply($scope);
- })
- ['finally'](() => {
+ }).finally(() => {
$timeout(() => {
isLoadingObjectSymlinkMeta = false;
}, 500);
diff --git a/app/main/files/transfer/uploads.html b/app/main/files/transfer/uploads.html
index 32508526..f75e394f 100644
--- a/app/main/files/transfer/uploads.html
+++ b/app/main/files/transfer/uploads.html
@@ -119,10 +119,12 @@
{{item.status|status:1}}
@@ -185,7 +187,14 @@
+
diff --git a/app/main/files/transfer/uploads.js b/app/main/files/transfer/uploads.js
index 2de62b91..4206302e 100644
--- a/app/main/files/transfer/uploads.js
+++ b/app/main/files/transfer/uploads.js
@@ -1,4 +1,3 @@
-
angular.module('web').controller('transferUploadsCtrl', [
'$scope',
'$timeout',
@@ -43,7 +42,8 @@ angular.module('web').controller('transferUploadsCtrl', [
);
},
limitToNum: 100,
- loadMoreUploadItems: loadMoreItems
+ loadMoreUploadItems: loadMoreItems,
+ copyMessage: copyMessage
});
function loadMoreItems() {
@@ -206,5 +206,13 @@ angular.module('web').controller('transferUploadsCtrl', [
);
}
}
+
+ /** 复制到剪贴板 */
+ function copyMessage(item) {
+ const { clipboard } = require('electron');
+ const { message, ecCode, requestId } = item;
+ clipboard.writeText(`Message: ${message}${ecCode ? '\nEC Code: ' + ecCode : ''}${requestId ? '\nRequest Id: ' + requestId : '' }`);
+ Toast.success(T('copy.successfully'));
+ }
}
]);
diff --git a/app/main/modals/settings.html b/app/main/modals/settings.html
index d20695f6..ffffe850 100644
--- a/app/main/modals/settings.html
+++ b/app/main/modals/settings.html
@@ -385,6 +385,30 @@ {{'settings.log'|translate}}
+