mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
chore: cloudcmd: actions: lint ☘️
This commit is contained in:
parent
7aacf203a0
commit
6b9d43e9ab
16 changed files with 28 additions and 9 deletions
|
|
@ -8,7 +8,7 @@ const testEnv = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const is17 = /^v1[789]/.test(process.version);
|
const is17 = /^v1[789]/.test(process.version);
|
||||||
const is20 = /^v2/.test(process.version);
|
const is20 = process.version.startsWith('v2');
|
||||||
|
|
||||||
// fix for ERR_OSSL_EVP_UNSUPPORTED on node v17
|
// fix for ERR_OSSL_EVP_UNSUPPORTED on node v17
|
||||||
// flag '--openssl-legacy-provider' not supported
|
// flag '--openssl-legacy-provider' not supported
|
||||||
|
|
|
||||||
1
HELP.md
1
HELP.md
|
|
@ -500,6 +500,7 @@ export default {
|
||||||
const data = await readDefaultMenu({
|
const data = await readDefaultMenu({
|
||||||
prefix,
|
prefix,
|
||||||
});
|
});
|
||||||
|
|
||||||
await createDefaultMenu({
|
await createDefaultMenu({
|
||||||
path,
|
path,
|
||||||
data,
|
data,
|
||||||
|
|
|
||||||
|
|
@ -327,6 +327,7 @@ function CloudCmdProto(DOM) {
|
||||||
if (!newObj)
|
if (!newObj)
|
||||||
// that's OK, error handled by RESTful
|
// that's OK, error handled by RESTful
|
||||||
return;
|
return;
|
||||||
|
|
||||||
options.sort = sort;
|
options.sort = sort;
|
||||||
options.order = order;
|
options.order = order;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,7 @@ module.exports.getNotCurrentDirPath = () => {
|
||||||
const panel = DOM.getPanel({
|
const panel = DOM.getPanel({
|
||||||
active: false,
|
active: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const path = DOM.getCurrentDirPath(panel);
|
const path = DOM.getCurrentDirPath(panel);
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
|
|
||||||
|
|
@ -216,10 +216,8 @@ async function onPathElementClick(panel, event) {
|
||||||
function copyPath(el) {
|
function copyPath(el) {
|
||||||
clipboard
|
clipboard
|
||||||
.writeText(el
|
.writeText(el
|
||||||
.parentElement
|
.parentElement.title)
|
||||||
.title)
|
.then(CloudCmd.log)
|
||||||
.then(CloudCmd
|
|
||||||
.log)
|
|
||||||
.catch(CloudCmd.log);
|
.catch(CloudCmd.log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -402,6 +400,7 @@ function dragndrop() {
|
||||||
return uploadFiles(files);
|
return uploadFiles(files);
|
||||||
|
|
||||||
const isFile = (item) => item.kind === 'file';
|
const isFile = (item) => item.kind === 'file';
|
||||||
|
|
||||||
const dirFiles = Array
|
const dirFiles = Array
|
||||||
.from(items)
|
.from(items)
|
||||||
.filter(isFile);
|
.filter(isFile);
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,11 @@ module.exports.init = () => {
|
||||||
|
|
||||||
const fm = DOM.getFM();
|
const fm = DOM.getFM();
|
||||||
const menuData = getMenuData(isAuth);
|
const menuData = getMenuData(isAuth);
|
||||||
|
|
||||||
const options = getOptions({
|
const options = getOptions({
|
||||||
type: 'context',
|
type: 'context',
|
||||||
});
|
});
|
||||||
|
|
||||||
const optionsFile = getOptions({
|
const optionsFile = getOptions({
|
||||||
type: 'file',
|
type: 'file',
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ async function initOperations(prefix, socketPrefix, fn) {
|
||||||
prefix,
|
prefix,
|
||||||
socketPrefix,
|
socketPrefix,
|
||||||
});
|
});
|
||||||
|
|
||||||
operator.on('connect', authCheck(operator, onConnect(fn)));
|
operator.on('connect', authCheck(operator, onConnect(fn)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ test('user-menu: parse-error: stack', (t) => {
|
||||||
const result = parseError({
|
const result = parseError({
|
||||||
stack,
|
stack,
|
||||||
});
|
});
|
||||||
|
|
||||||
const expected = [1, 2];
|
const expected = [1, 2];
|
||||||
|
|
||||||
t.deepEqual(result, expected);
|
t.deepEqual(result, expected);
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ function getPathLink(url, prefix, template) {
|
||||||
'/',
|
'/',
|
||||||
...names,
|
...names,
|
||||||
];
|
];
|
||||||
|
|
||||||
const lines = [];
|
const lines = [];
|
||||||
const n = allNames.length;
|
const n = allNames.length;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,11 @@ test('cloudfunc: buildFromJSON: ..', (t) => {
|
||||||
|
|
||||||
const $ = cheerio.load(html);
|
const $ = cheerio.load(html);
|
||||||
const el = $('[data-name="js-file-Li4="]');
|
const el = $('[data-name="js-file-Li4="]');
|
||||||
|
|
||||||
const result = el
|
const result = el
|
||||||
.find('[data-name="js-name"]')
|
.find('[data-name="js-name"]')
|
||||||
.text();
|
.text();
|
||||||
|
|
||||||
const expected = '..';
|
const expected = '..';
|
||||||
|
|
||||||
t.equal(result, expected);
|
t.equal(result, expected);
|
||||||
|
|
|
||||||
|
|
@ -101,8 +101,7 @@ function sendData(params, config, callback) {
|
||||||
return onGET(params, config, callback);
|
return onGET(params, config, callback);
|
||||||
|
|
||||||
case 'PUT':
|
case 'PUT':
|
||||||
return pullout(p
|
return pullout(p.request)
|
||||||
.request)
|
|
||||||
.then((body) => {
|
.then((body) => {
|
||||||
onPUT({
|
onPUT({
|
||||||
name: p.name,
|
name: p.name,
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ module.exports = {
|
||||||
|
|
||||||
'F6 - Copy URL to current file': async ({DOM}) => {
|
'F6 - Copy URL to current file': async ({DOM}) => {
|
||||||
const {copyURLToCurrentFile} = await import(`${CDN}/menu/copy-url-to-current-file.js`);
|
const {copyURLToCurrentFile} = await import(`${CDN}/menu/copy-url-to-current-file.js`);
|
||||||
|
|
||||||
await copyURLToCurrentFile({
|
await copyURLToCurrentFile({
|
||||||
DOM,
|
DOM,
|
||||||
});
|
});
|
||||||
|
|
@ -24,6 +25,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
'Y - Convert YouTube to MP3': async ({CloudCmd, DOM}) => {
|
'Y - Convert YouTube to MP3': async ({CloudCmd, DOM}) => {
|
||||||
const {convertYouTubeToMp3} = await import(`${CDN}/menu/convert-youtube-to-mp3.js`);
|
const {convertYouTubeToMp3} = await import(`${CDN}/menu/convert-youtube-to-mp3.js`);
|
||||||
|
|
||||||
await convertYouTubeToMp3({
|
await convertYouTubeToMp3({
|
||||||
CloudCmd,
|
CloudCmd,
|
||||||
DOM,
|
DOM,
|
||||||
|
|
@ -32,6 +34,7 @@ module.exports = {
|
||||||
|
|
||||||
'F - Convert flac to mp3 [ffmpeg]': async ({CloudCmd, DOM}) => {
|
'F - Convert flac to mp3 [ffmpeg]': async ({CloudCmd, DOM}) => {
|
||||||
const {convertFlacToMp3} = await import(`${CDN}/menu/ffmpeg.js`);
|
const {convertFlacToMp3} = await import(`${CDN}/menu/ffmpeg.js`);
|
||||||
|
|
||||||
await convertFlacToMp3({
|
await convertFlacToMp3({
|
||||||
CloudCmd,
|
CloudCmd,
|
||||||
DOM,
|
DOM,
|
||||||
|
|
@ -39,6 +42,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
'M - Convert mp4 to mp3 [ffmpeg]': async ({CloudCmd, DOM}) => {
|
'M - Convert mp4 to mp3 [ffmpeg]': async ({CloudCmd, DOM}) => {
|
||||||
const {convertMp4ToMp3} = await import(`${CDN}/menu/ffmpeg.js`);
|
const {convertMp4ToMp3} = await import(`${CDN}/menu/ffmpeg.js`);
|
||||||
|
|
||||||
await convertMp4ToMp3({
|
await convertMp4ToMp3({
|
||||||
CloudCmd,
|
CloudCmd,
|
||||||
DOM,
|
DOM,
|
||||||
|
|
@ -47,6 +51,7 @@ module.exports = {
|
||||||
|
|
||||||
'O - Convert mov to mp3 [ffmpeg]': async ({CloudCmd, DOM}) => {
|
'O - Convert mov to mp3 [ffmpeg]': async ({CloudCmd, DOM}) => {
|
||||||
const {convertMovToMp3} = await import(`${CDN}/menu/ffmpeg.js`);
|
const {convertMovToMp3} = await import(`${CDN}/menu/ffmpeg.js`);
|
||||||
|
|
||||||
await convertMovToMp3({
|
await convertMovToMp3({
|
||||||
CloudCmd,
|
CloudCmd,
|
||||||
DOM,
|
DOM,
|
||||||
|
|
@ -72,6 +77,7 @@ module.exports = {
|
||||||
const data = await readDefaultMenu({
|
const data = await readDefaultMenu({
|
||||||
prefix,
|
prefix,
|
||||||
});
|
});
|
||||||
|
|
||||||
await createDefaultMenu({
|
await createDefaultMenu({
|
||||||
path,
|
path,
|
||||||
data,
|
data,
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,7 @@ function before(options, fn = options) {
|
||||||
|
|
||||||
server.listen(() => {
|
server.listen(() => {
|
||||||
fn(server
|
fn(server
|
||||||
.address()
|
.address().port, promisify(after));
|
||||||
.port, promisify(after));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ test('cloudcmd: client: listeners: getRange: direct', (t) => {
|
||||||
'how',
|
'how',
|
||||||
'come',
|
'come',
|
||||||
];
|
];
|
||||||
|
|
||||||
const result = getRange(0, 1, files);
|
const result = getRange(0, 1, files);
|
||||||
|
|
||||||
t.deepEqual(result, expected, 'should return range');
|
t.deepEqual(result, expected, 'should return range');
|
||||||
|
|
@ -33,6 +34,7 @@ test('cloudcmd: client: listeners: getRange: reverse', (t) => {
|
||||||
'how',
|
'how',
|
||||||
'come',
|
'come',
|
||||||
];
|
];
|
||||||
|
|
||||||
const result = getRange(1, 0, files);
|
const result = getRange(1, 0, files);
|
||||||
|
|
||||||
t.deepEqual(result, expected, 'should return range');
|
t.deepEqual(result, expected, 'should return range');
|
||||||
|
|
@ -46,6 +48,7 @@ test('cloudcmd: client: listeners: getRange: one', (t) => {
|
||||||
'how',
|
'how',
|
||||||
'come',
|
'come',
|
||||||
];
|
];
|
||||||
|
|
||||||
const result = getRange(0, 0, files);
|
const result = getRange(0, 0, files);
|
||||||
|
|
||||||
t.deepEqual(result, expected, 'should return range');
|
t.deepEqual(result, expected, 'should return range');
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ test('cloudcmd: console: enabled', async (t) => {
|
||||||
const {port, done} = await connect({
|
const {port, done} = await connect({
|
||||||
config,
|
config,
|
||||||
});
|
});
|
||||||
|
|
||||||
const socket = io(`http://localhost:${port}/console`);
|
const socket = io(`http://localhost:${port}/console`);
|
||||||
|
|
||||||
socket.emit('auth', configFn('username'), configFn('password'));
|
socket.emit('auth', configFn('username'), configFn('password'));
|
||||||
|
|
@ -39,6 +40,7 @@ test('cloudcmd: console: disabled', async (t) => {
|
||||||
const {port, done} = await connect({
|
const {port, done} = await connect({
|
||||||
config,
|
config,
|
||||||
});
|
});
|
||||||
|
|
||||||
const socket = io(`http://localhost:${port}/console`);
|
const socket = io(`http://localhost:${port}/console`);
|
||||||
|
|
||||||
const [error] = await once(socket, 'connect_error');
|
const [error] = await once(socket, 'connect_error');
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ test('cloudcmd: /cloudcmd.js: auth: no password', async (t) => {
|
||||||
const encoded = Buffer
|
const encoded = Buffer
|
||||||
.from(`${username}:`)
|
.from(`${username}:`)
|
||||||
.toString('base64');
|
.toString('base64');
|
||||||
|
|
||||||
const authorization = `Basic ${encoded}`;
|
const authorization = `Basic ${encoded}`;
|
||||||
|
|
||||||
const {status} = await request.get(`/${name}`, {
|
const {status} = await request.get(`/${name}`, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue