Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
terminal.on('keypress', function (ch, key) {
if (key.meta && /^[0-9]$/.test(key.name)) {
// Navigate to pages by id
blur();
// Let's re-emit the event
screen.emit('keypress', ch, key);
} else if (key.ctrl) {
// We rely on the clipboard event API in Web browsers
if (key.name === 'c') {
// Copy to clipboard
if (terminal.hasSelection()) {
if (os.platform() === 'browser') {
document.execCommand('copy');
} else {
clipboardy.writeSync(terminal.getSelectedText());
}
skipInputDataOnce = true;
}
} else if (key.name === 'v') {
if (os.platform() === 'browser') {
document.execCommand('paste');
} else {
// Paste from clipboard
input(clipboardy.readSync());
terminal.clearSelection();
// scrolls to bottom
terminal.setScrollPerc(100);
}
skipInputDataOnce = true;
}
}
server.once('listening', () => {
const { port } = server.address();
const uri = `${options.protocol}://${options.host}:${port}`;
log.info(chalk`Project is running at {blue ${uri}}`);
if (options.clipboard && !options.open) {
try {
// eslint-disable-next-line global-require
const clip = require('clipboardy');
clip.writeSync(uri);
log.info(chalk.grey('Server URI copied to clipboard'));
} catch (error) {
log.warn(
chalk.grey(
'Failed to copy server URI to clipboard. ' +
"Use logLevel: 'debug' for more information."
)
);
log.debug(error);
}
}
bus.emit('listening', { server, options });
if (options.open) {
const open = require('opn'); // eslint-disable-line global-require
// make sound
// ref: https://github.com/JannesMeyer/system-bell-webpack-plugin/blob/bb35caf/SystemBellPlugin.js#L14
if (process.env.SYSTEM_BELL !== 'none') {
process.stdout.write('\x07');
}
send({
type: ERROR,
});
onFail({ stats });
return;
}
let copied = '';
if (isFirstCompile && !IS_CI && !SILENT) {
try {
require('clipboardy').writeSync(urls.localUrlForBrowser);
copied = chalk.dim('(copied to clipboard)');
} catch (e) {
copied = chalk.red(`(copy to clipboard failed)`);
}
console.log();
console.log(
[
` App running at:`,
` - Local: ${chalk.cyan(urls.localUrlForTerminal)} ${copied}`,
urls.lanUrlForTerminal ? ` - Network: ${chalk.cyan(urls.lanUrlForTerminal)}` : '',
].join('\n'),
);
console.log();
}
onCompileDone({
export const copyToClipboard = (str: string) => {
if (process.platform === 'linux' && !process.env.DISPLAY) {
// skip, probably running on a server
return
}
clipboardy.writeSync(str)
}
async selectPath(path: string): Promise {
const absolutePath = pathj.resolve(path);
if (!fs.existsSync(absolutePath)) {
throw new Error('The selected path does not exist');
}
await robot.sendKey('left');
await new Promise((res) => { setTimeout(res, 500); });
await robot.sendKey('up');
await new Promise((res) => { setTimeout(res, 500); });
await robot.sendKey('down');
await new Promise((res) => { setTimeout(res, 500); });
await robot.sendKey('enter');
await new Promise((res) => { setTimeout(res, 500); });
await robot.sendCombination(['control', 'l']);
await new Promise((res) => { setTimeout(res, 500); });
clipboard.writeSync(absolutePath);
await robot.sendCombination(['control', 'v']);
clipboard.writeSync('');
}
next = false
} else {
urlnya = url
}
}
next = [...shorturl, ...safeurl, ...safeurl2, ...safelink2].indexOf(urlz.parse(urlnya).hostname.replace(/^(?:https?:\/\/)?(?:www\.)?/i, "").split('/')[0]) !== -1 ? urlnya : false;
if (next) {
Pancal(next, save, config)
} else {
if (save) {
collect[config.reso][config.server] = urlnya
fs.writeFileSync('./[' + config.type + ']' + config.name + '.txt', JSON.stringify(collect, null, 4))
console.log(`Proccesing...`)
} else {
console.log(`URL : ${chalk.blue(urlnya)}`)
clipboard.writeSync(urlnya)
console.log(chalk.green('URL Has Copy On Your Clipboard'))
}
}
}
this.bitcoinCopyButton.on("press", () => {
clipboardy.writeSync("1FJqNsijJpctJwsFB4LPhf7KEKNYVb1Mcd");
});
this.paypalCopyButton.on("press", () => {
clipboardy.writeSync("https://goo.gl/m2HsD6");
});
const copyUrl = url => {
const spinner = ora()
spinner.start('📋 Copying HTTP gateway URL to clipboard…')
try {
clipboardy.writeSync(url)
spinner.succeed('📋 Copied HTTP gateway URL to clipboard:')
spinner.info(linkUrl(url))
return url
} catch (e) {
spinner.fail('⚠️ Could not copy URL to clipboard.')
logError(e)
return undefined
}
}
const gulpPath = `${files.slash(destPath)}gulpfile.js`
files.makeDirectory(gulpPath)
for (let i = 0; i < helpers.length; i += 1) {
if (answers.override2) {
files.copyFile(helpers[i], destPath, helpers[i], true)
}
}
const saved = config.save(destPath)
if (saved) {
const cmd = `${answers.yarn ? 'yarn add -s -D' : 'npm i -s -D'} ${libs.join(' ')}`
clipboardy.writeSync(cmd)
log.message('Config saved successfully! Use the following command to install gulp dependencies:\n', false)
log.message(cmd, false)
log.message('\nCommand is copied to clipboard.')
log.message('\nWarning: installation could last for a few minutes.')
} else {
log.message('Config not saved!')
}
}
}