mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 13:42:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
97
web/node_modules/opn/index.js
generated
vendored
Normal file
97
web/node_modules/opn/index.js
generated
vendored
Normal file
|
@ -0,0 +1,97 @@
|
|||
'use strict';
|
||||
const path = require('path');
|
||||
const childProcess = require('child_process');
|
||||
const isWsl = require('is-wsl');
|
||||
|
||||
module.exports = (target, opts) => {
|
||||
if (typeof target !== 'string') {
|
||||
return Promise.reject(new Error('Expected a `target`'));
|
||||
}
|
||||
|
||||
opts = Object.assign({wait: true}, opts);
|
||||
|
||||
let cmd;
|
||||
let appArgs = [];
|
||||
let args = [];
|
||||
const cpOpts = {};
|
||||
|
||||
if (Array.isArray(opts.app)) {
|
||||
appArgs = opts.app.slice(1);
|
||||
opts.app = opts.app[0];
|
||||
}
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
cmd = 'open';
|
||||
|
||||
if (opts.wait) {
|
||||
args.push('-W');
|
||||
}
|
||||
|
||||
if (opts.app) {
|
||||
args.push('-a', opts.app);
|
||||
}
|
||||
} else if (process.platform === 'win32' || isWsl) {
|
||||
cmd = 'cmd' + (isWsl ? '.exe' : '');
|
||||
args.push('/c', 'start', '""', '/b');
|
||||
target = target.replace(/&/g, '^&');
|
||||
|
||||
if (opts.wait) {
|
||||
args.push('/wait');
|
||||
}
|
||||
|
||||
if (opts.app) {
|
||||
args.push(opts.app);
|
||||
}
|
||||
|
||||
if (appArgs.length > 0) {
|
||||
args = args.concat(appArgs);
|
||||
}
|
||||
} else {
|
||||
if (opts.app) {
|
||||
cmd = opts.app;
|
||||
} else {
|
||||
const useSystemXdgOpen = process.versions.electron || process.platform === 'android';
|
||||
cmd = useSystemXdgOpen ? 'xdg-open' : path.join(__dirname, 'xdg-open');
|
||||
}
|
||||
|
||||
if (appArgs.length > 0) {
|
||||
args = args.concat(appArgs);
|
||||
}
|
||||
|
||||
if (!opts.wait) {
|
||||
// `xdg-open` will block the process unless
|
||||
// stdio is ignored and it's detached from the parent
|
||||
// even if it's unref'd
|
||||
cpOpts.stdio = 'ignore';
|
||||
cpOpts.detached = true;
|
||||
}
|
||||
}
|
||||
|
||||
args.push(target);
|
||||
|
||||
if (process.platform === 'darwin' && appArgs.length > 0) {
|
||||
args.push('--args');
|
||||
args = args.concat(appArgs);
|
||||
}
|
||||
|
||||
const cp = childProcess.spawn(cmd, args, cpOpts);
|
||||
|
||||
if (opts.wait) {
|
||||
return new Promise((resolve, reject) => {
|
||||
cp.once('error', reject);
|
||||
|
||||
cp.once('close', code => {
|
||||
if (code > 0) {
|
||||
reject(new Error('Exited with code ' + code));
|
||||
return;
|
||||
}
|
||||
|
||||
resolve(cp);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
cp.unref();
|
||||
|
||||
return Promise.resolve(cp);
|
||||
};
|
9
web/node_modules/opn/license
generated
vendored
Normal file
9
web/node_modules/opn/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
25
web/node_modules/opn/node_modules/is-wsl/index.js
generated
vendored
Normal file
25
web/node_modules/opn/node_modules/is-wsl/index.js
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
'use strict';
|
||||
const os = require('os');
|
||||
const fs = require('fs');
|
||||
|
||||
const isWsl = () => {
|
||||
if (process.platform !== 'linux') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (os.release().includes('Microsoft')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
return fs.readFileSync('/proc/version', 'utf8').includes('Microsoft');
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
if (process.env.__IS_WSL_TEST__) {
|
||||
module.exports = isWsl;
|
||||
} else {
|
||||
module.exports = isWsl();
|
||||
}
|
21
web/node_modules/opn/node_modules/is-wsl/license
generated
vendored
Normal file
21
web/node_modules/opn/node_modules/is-wsl/license
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
40
web/node_modules/opn/node_modules/is-wsl/package.json
generated
vendored
Normal file
40
web/node_modules/opn/node_modules/is-wsl/package.json
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"name": "is-wsl",
|
||||
"version": "1.1.0",
|
||||
"description": "Check if the process is running inside Windows Subsystem for Linux (Bash on Windows)",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/is-wsl",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"check",
|
||||
"wsl",
|
||||
"windows",
|
||||
"subsystem",
|
||||
"linux",
|
||||
"detect",
|
||||
"bash",
|
||||
"process",
|
||||
"console",
|
||||
"terminal",
|
||||
"is"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"clear-require": "^2.0.0",
|
||||
"proxyquire": "^1.7.11",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
28
web/node_modules/opn/node_modules/is-wsl/readme.md
generated
vendored
Normal file
28
web/node_modules/opn/node_modules/is-wsl/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
# is-wsl [](https://travis-ci.org/sindresorhus/is-wsl)
|
||||
|
||||
> Check if the process is running inside [Windows Subsystem for Linux](https://msdn.microsoft.com/commandline/wsl/about) (Bash on Windows)
|
||||
|
||||
Can be useful if you need to work around unimplemented or buggy features in WSL.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save is-wsl
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const isWsl = require('is-wsl');
|
||||
|
||||
// When running inside Windows Subsystem for Linux
|
||||
console.log(isWsl);
|
||||
//=> true
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
56
web/node_modules/opn/package.json
generated
vendored
Normal file
56
web/node_modules/opn/package.json
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"name": "opn",
|
||||
"version": "5.5.0",
|
||||
"description": "A better node-open. Opens stuff like websites, files, executables. Cross-platform.",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/opn",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"xdg-open"
|
||||
],
|
||||
"keywords": [
|
||||
"app",
|
||||
"open",
|
||||
"opn",
|
||||
"opener",
|
||||
"opens",
|
||||
"launch",
|
||||
"start",
|
||||
"xdg-open",
|
||||
"xdg",
|
||||
"default",
|
||||
"cmd",
|
||||
"browser",
|
||||
"editor",
|
||||
"executable",
|
||||
"exe",
|
||||
"url",
|
||||
"urls",
|
||||
"arguments",
|
||||
"args",
|
||||
"spawn",
|
||||
"exec",
|
||||
"child",
|
||||
"process",
|
||||
"website",
|
||||
"file"
|
||||
],
|
||||
"dependencies": {
|
||||
"is-wsl": "^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^0.25.0",
|
||||
"xo": "^0.20.0"
|
||||
}
|
||||
}
|
90
web/node_modules/opn/readme.md
generated
vendored
Normal file
90
web/node_modules/opn/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,90 @@
|
|||
# opn
|
||||
|
||||
> A better [node-open](https://github.com/pwnall/node-open). Opens stuff like websites, files, executables. Cross-platform.
|
||||
|
||||
If need this for Electron, use [`shell.openItem()`](https://electronjs.org/docs/api/shell#shellopenitemfullpath) instead.
|
||||
|
||||
|
||||
#### Why?
|
||||
|
||||
- Actively maintained
|
||||
- Supports app arguments
|
||||
- Safer as it uses `spawn` instead of `exec`
|
||||
- Fixes most of the open `node-open` issues
|
||||
- Includes the latest [`xdg-open` script](http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=c55122295c2a480fa721a9614f0e2d42b2949c18) for Linux
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install opn
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const opn = require('opn');
|
||||
|
||||
// Opens the image in the default image viewer
|
||||
opn('unicorn.png').then(() => {
|
||||
// image viewer closed
|
||||
});
|
||||
|
||||
// Opens the url in the default browser
|
||||
opn('http://sindresorhus.com');
|
||||
|
||||
// Specify the app to open in
|
||||
opn('http://sindresorhus.com', {app: 'firefox'});
|
||||
|
||||
// Specify app arguments
|
||||
opn('http://sindresorhus.com', {app: ['google chrome', '--incognito']});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
Uses the command `open` on macOS, `start` on Windows and `xdg-open` on other platforms.
|
||||
|
||||
### opn(target, [options])
|
||||
|
||||
Returns a promise for the [spawned child process](https://nodejs.org/api/child_process.html#child_process_class_childprocess). You would normally not need to use this for anything, but it can be useful if you'd like to attach custom event listeners or perform other operations directly on the spawned process.
|
||||
|
||||
#### target
|
||||
|
||||
Type: `string`
|
||||
|
||||
The thing you want to open. Can be a URL, file, or executable.
|
||||
|
||||
Opens in the default app for the file type. For example, URLs opens in your default browser.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### wait
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Wait for the opened app to exit before fulfilling the promise. If `false` it's fulfilled immediately when opening the app.
|
||||
|
||||
On Windows you have to explicitly specify an app for it to be able to wait.
|
||||
|
||||
##### app
|
||||
|
||||
Type: `string` `Array`
|
||||
|
||||
Specify the app to open the `target` with, or an array with the app and app arguments.
|
||||
|
||||
The app name is platform dependent. Don't hard code it in reusable modules. For example, Chrome is `google chrome` on macOS, `google-chrome` on Linux and `chrome` on Windows.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [opn-cli](https://github.com/sindresorhus/opn-cli) - CLI for this module
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
1066
web/node_modules/opn/xdg-open
generated
vendored
Executable file
1066
web/node_modules/opn/xdg-open
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue