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