Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
bot.on('scan', (qrcode, status) => {
qrTerm.generate(qrcode, { small: true }) // show qrcode on console
const qrcodeImageUrl = [
'https://api.qrserver.com/v1/create-qr-code/?data=',
encodeURIComponent(qrcode),
'&size=220x220&margin=20',
].join('')
console.log(qrcodeImageUrl)
})
entry['index.bundle.min'] = [paths.appIndexJs];
} else {
entry['index.bundle'] = [paths.appIndexJs];
}
if (!isProducation) {
var ip = internalIp.v4();
var port = 8080;
var webUrl = 'http://' + ip + ':' + port;
var bundleUrl = 'http://' + ip + ':' + port + '/js/index.bundle.js';
var weexBundleUrl = bundleUrl + '?_wx_tpl=' + bundleUrl;
qrcode.generate(webUrl, {small: true});
console.log('Web: scan above QRCode ' + webUrl + ' or direct open in browser.\n');
qrcode.generate(weexBundleUrl, {small: true});
console.log('Weex: scan above QRCode ' + weexBundleUrl + ' use weex playground.\n');
}
module.exports = {
// Compile target should "web" when use hot reload
target: isProducation ? 'node' : 'web',
// devtool: 'inline-source-map',
// These are the "entry points" to our application.
// This means they will be the "root" imports that are included in JS bundle.
// The first two entry points enable "hot" CSS and auto-refreshes for JS.
entry: entry,
output: {
// Next line is not used in dev but WebpackDevServer crashes without it:
// TODO minimal option to exclude these defaults
url = url
.replace(/issuer=([^&]*)&?/, '')
.replace(/digits=6&?/, '')
.replace(/algorithm=SHA1&?/, '')
.replace(/period=30&?/, '')
.replace(/(&|\?)$/, '')
;
state.state = 'qr';
state.msgs = [
"Create a New Account" + (state.totpRetry && (" (Take #" + (state.totpRetry + 1) + ")") || '')
, ""
];
qrcode.setErrorLevel('L'); // L: 7%, M: 15%, Q: 25%, H: 30%
qrcode.generate(url, function (qr) {
state.qr = qr;
state.msgs.push('__RAW__');
});
state.msgs.push('');
state.msgs.push("Download the Authy App at https://www.authy.com/app/");
state.msgs.push('');
state.msgs.push(url);
state.msgs.push('');
state.msgs.push("Type the 6-digit token below:");
state.error = null;
state.prompt = '6-digit Token: ';
// TODO handle token as 000000 with delimeters '-', ' ', or '.'
handleInput(ws, state, function (err, token) {
exports.output = function(tx) {
console.log('0x' + tx.toString('hex'));
qr.generate(tx.toString('hex'), {small: true});
}
async _startRemoteBrowser(runner) {
const remoteConnection = await this.testcafe.createBrowserConnection();
console.log('Connect your device to the following URL or scan QR Code: ', remoteConnection.url);
qrcode.generate(remoteConnection.url);
remoteConnection.once('ready', () => {
runner
.src(this.dummyTestcafeFile)
.browsers(remoteConnection)
.reporter('minimal')
.run({
selectorTimeout: this.options.waitForTimeout,
skipJsErrors: true,
skipUncaughtErrors: true,
})
.catch((err) => {
this.debugSection('_before', `Error ${err.toString()}`);
this.isRunning = false;
this.testcafe.close();
});
});
.on('scan', (qrcode, status) => {
QrcodeTerminal.generate(qrcode)
console.log(`${qrcode}\n[${status}] Scan QR Code in above url to login: `)
})
* \`qrip 4000\` to simply generate a QR code with your local network address + the specified port (400 in this case)
* \`qrip 4000 /landing/hi\` to do the above and append \`/landing/hi\` to the URL.
All other options you pass in will be lost in time, like tears in rain.
`)
} else {
const [port, path = ''] = args
const interfaces = os.networkInterfaces()
const [{address: ip}] = Object.keys(interfaces)
.reduce((a, v) => [...a, ...interfaces[v]], [])
.filter(i => i.internal === false && i.family === 'IPv4')
const url = `http://${ip}:${port + path}`
console.log(`generating QR code for ${url} \n`)
Q.generate(url)
}
getQrLink((qrcodeUrl, verifier) => {
console.info('> Please login to your LINE account');
console.info('> Your qrLink: ' + qrcodeUrl);
qrcode.generate(qrcodeUrl, {
small: true
});
qrLogin(verifier, (res) => {
console.info('> AuthToken: ' + res.authToken);
console.info('> Login Success');
options.path = config.LINE_POLL_URL;
setTHttpClient(options);
callback(res);
})
})
break;
runAsync: _asyncToGenerator(function* (env) {
var argv = env.argv;
var args = argv._;
var err = null;
var url = yield urlUtil.urlFromEnvAsync(env);
console.log(url);
if (argv.qr) {
qrcodeTerminal.generate(url);
}
var test = argv.test;
if (test) {
log('Testing loading the URL...');
simpleSpinner.start();
try {
var ok = yield urlUtil.testUrlAsync(url);
} catch (e) {
throw CommandError('RUN_EXP_START_FIRST', env, 'You may need to run `exp start` to get a URL\n' + e.message);
} finally {
simpleSpinner.stop();
}
log('OK.');
}
await preferences.setItem(configurationKey, prefs);
let webConfiguration = {
"webBaseURL": prefs.currentURL,
"localBaseURL": prefs.local_ip
};
await setWebConfiguration(preferences, webConfiguration);
const webURL = prefs.assets_web ? prefs.local_ip : tunnelURL;
log('\nLibrarian is up at: ');
log(chalk.yellow.bold(webURL));
log('\nScan the QR code to jump to Librarian\'s web interface:');
qrcode.generate(webURL);
await checkForUpdate(preferences);
});