//GET routes //Regex suck, but it's popular, and is used by router to do matching. This basically only matches: /, /what, /why, /who, /when, /how router.get(/^(\/|\/what|\/why|\/who|\/how)(?:\/(?=$))?$/i, function(req, res, next) { //get the requested page var page = getPage(req.url, "what"); var initialData = { config:config }; var header = getHeader(initialData); var menu = getMenu(page, initialData); var contentPanel = getContentPanel(page, initialData); res.render('index', { title:config.props.title, header : header, menu : menu, contentPanel: contentPanel, initialData:stringify(initialData, null, 2)}); });
function normalizeOutputValue (result) { const util = require('../lib/util.js') if (util.isNullOrUndefined(result)) { result = '' } else if (util.isString(result)) { result = result.trim('\n') } else if (util.isArray(result) || util.isRealObject(result)) { const stringify = require('json-stringify-safe') result = stringify(result) } return result }
function formatKey(reg) { return stringify(reg); }
ethereum.removeAccountFromWallet(req.params.publicKey).then((value) => { return res.send(stringify(value)) });
args.forEach((msg, index) => { // Error object if (msg instanceof Error) { if (msg.stack.indexOf(msg.message) >= 0) { msgStr += msg.stack.replace(breakLineReg, '<br>') .replace(/ /g, ' '); } else { msgStr += `${msg.message}<br>${msg.stack.replace(breakLineReg, '<br>') .replace(/ /g, ' ')}`; } } else if (typeof msg === 'object') { msgStr += `###${stringify(msg)}###`; } else { msgStr += String(msg); } if (args.length - 1 !== index) { msgStr += ' '; } });
function ipcSend(args, print) { /** * For debug purpose */ if (process.env.MODULE_DEBUG) console.log(args); if (!process.send) { var output = args.data; delete output.__name; return false; } try { process.send(JSON.parse(stringify(args))); } catch(e) { console.error('Process disconnected from parent !'); console.error(e.stack || e); process.exit(1); } }
ethereum.createWalletAccounts().then((value) => { return res.send(stringify(value)) });
setStatus (status, description, details) { let _description = description || constants.MSG_NO_DESCRIPTION; let _details = typeof details === 'object' ? stringify(details) : details || _description; _details = _details.startsWith(this.config.name) ? _details : `${this.config.name} > ${_details}`; let _status = status;
//routes for ajax enabled panel component calls //Regex suck, but it's popular, and is used by router to do matching. This basically only matches: /what/get, /why/get, /who/get, /when/get, /how/get router.get(/^(\/what\/get|\/why\/get|\/who\/get|\/how\/get)(?:\/(?=$))?$/i, function(req, res, next) { //this is a BAD way of delaying the response. It is ONLY here to help show the javascript on the client side kick in to progressively enhance the UX //setTimeout(function() { //get the requested page var page = getPage(req.url); var contentPanel = getParsedPage(page); var data = {'contentPanel' : contentPanel}; res.send(stringify(data, null, 2)); //}, 1500); });
ethereum.addAccountToWallet(req.params.privateKey).then((value) => { return res.send(stringify(value)) });
ethereum.clearWallet().then((value) => { return res.send(stringify(value)) });
ethereum.getWallet().then((value) => { return res.send(stringify(value)) });