forked from Qortal/qortal-ui
added become a minter route
This commit is contained in:
parent
4dd62f9eb6
commit
82406bd2e4
@ -1,137 +1,141 @@
|
||||
require('events').EventEmitter.defaultMaxListeners = 0
|
||||
const path = require("path");
|
||||
const { nodeResolve } = require("@rollup/plugin-node-resolve");
|
||||
const progress = require("rollup-plugin-progress");
|
||||
require('events').EventEmitter.defaultMaxListeners = 0;
|
||||
const path = require('path');
|
||||
const { nodeResolve } = require('@rollup/plugin-node-resolve');
|
||||
const progress = require('rollup-plugin-progress');
|
||||
const replace = require('@rollup/plugin-replace');
|
||||
const globals = require("rollup-plugin-node-globals");
|
||||
const commonjs = require("@rollup/plugin-commonjs");
|
||||
const alias = require("@rollup/plugin-alias");
|
||||
const globals = require('rollup-plugin-node-globals');
|
||||
const commonjs = require('@rollup/plugin-commonjs');
|
||||
const alias = require('@rollup/plugin-alias');
|
||||
const { terser } = require('rollup-plugin-terser');
|
||||
const babel = require("@rollup/plugin-babel");
|
||||
const babel = require('@rollup/plugin-babel');
|
||||
|
||||
const aliases = {};
|
||||
|
||||
const generateRollupConfig = (inputFile, outputFile) => {
|
||||
return {
|
||||
inputOptions: {
|
||||
onwarn: (warning, rollupWarn) => {
|
||||
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
|
||||
rollupWarn(warning)
|
||||
}
|
||||
},
|
||||
input: inputFile,
|
||||
plugins: [
|
||||
alias({
|
||||
entries: Object.keys(aliases).map((find) => {
|
||||
return {
|
||||
find,
|
||||
replacement: aliases[find],
|
||||
};
|
||||
}),
|
||||
}),
|
||||
nodeResolve({
|
||||
preferBuiltins: false,
|
||||
mainFields: ['module', 'browser']
|
||||
}),
|
||||
replace({
|
||||
preventAssignment: true,
|
||||
"process.env.NODE_ENV": JSON.stringify("production"),
|
||||
}),
|
||||
commonjs(),
|
||||
globals(),
|
||||
progress(),
|
||||
babel.babel({
|
||||
babelHelpers: 'bundled',
|
||||
exclude: "node_modules/**",
|
||||
}),
|
||||
terser({
|
||||
compress: true,
|
||||
output: {
|
||||
comments: false,
|
||||
},
|
||||
})
|
||||
],
|
||||
},
|
||||
outputOptions: {
|
||||
file: outputFile,
|
||||
format: "umd",
|
||||
},
|
||||
};
|
||||
return {
|
||||
inputOptions: {
|
||||
onwarn: (warning, rollupWarn) => {
|
||||
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
|
||||
rollupWarn(warning);
|
||||
}
|
||||
},
|
||||
input: inputFile,
|
||||
plugins: [
|
||||
alias({
|
||||
entries: Object.keys(aliases).map((find) => {
|
||||
return {
|
||||
find,
|
||||
replacement: aliases[find],
|
||||
};
|
||||
}),
|
||||
}),
|
||||
nodeResolve({
|
||||
preferBuiltins: false,
|
||||
mainFields: ['module', 'browser'],
|
||||
}),
|
||||
replace({
|
||||
preventAssignment: true,
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
}),
|
||||
commonjs(),
|
||||
globals(),
|
||||
progress(),
|
||||
babel.babel({
|
||||
babelHelpers: 'bundled',
|
||||
exclude: 'node_modules/**',
|
||||
}),
|
||||
terser({
|
||||
compress: true,
|
||||
output: {
|
||||
comments: false,
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
outputOptions: {
|
||||
file: outputFile,
|
||||
format: 'umd',
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const generateForPlugins = () => {
|
||||
const configs = [
|
||||
{
|
||||
in: "plugins/core/main.src.js",
|
||||
out: "plugins/core/main.js",
|
||||
},
|
||||
{
|
||||
in: "plugins/core/trade-portal/trade-portal.src.js",
|
||||
out: "plugins/core/trade-portal/trade-portal.js",
|
||||
},
|
||||
{
|
||||
in: "plugins/core/wallet/wallet-app.src.js",
|
||||
out: "plugins/core/wallet/wallet-app.js",
|
||||
},
|
||||
{
|
||||
in: "plugins/core/reward-share/reward-share.src.js",
|
||||
out: "plugins/core/reward-share/reward-share.js",
|
||||
},
|
||||
{
|
||||
in: "plugins/core/node-management/node-management.src.js",
|
||||
out: "plugins/core/node-management/node-management.js",
|
||||
},
|
||||
{
|
||||
in: "plugins/core/group-management/group-management.src.js",
|
||||
out: "plugins/core/group-management/group-management.js",
|
||||
},
|
||||
{
|
||||
in: "plugins/core/name-registration/name-registration.src.js",
|
||||
out: "plugins/core/name-registration/name-registration.js",
|
||||
},
|
||||
{
|
||||
in: "plugins/core/qdn/websites.src.js",
|
||||
out: "plugins/core/qdn/websites.js",
|
||||
},
|
||||
{
|
||||
in: "plugins/core/qdn/publish/publish.src.js",
|
||||
out: "plugins/core/qdn/publish/publish.js",
|
||||
},
|
||||
{
|
||||
in: "plugins/core/qdn/browser/browser.src.js",
|
||||
out: "plugins/core/qdn/browser/browser.js",
|
||||
},
|
||||
{
|
||||
in: "plugins/core/qdn/data-management/data-management.src.js",
|
||||
out: "plugins/core/qdn/data-management/data-management.js",
|
||||
},
|
||||
{
|
||||
in: "plugins/core/messaging/messaging.src.js",
|
||||
out: "plugins/core/messaging/messaging.js",
|
||||
},
|
||||
{
|
||||
in: "plugins/core/messaging/chain-messaging/chain-messaging.src.js",
|
||||
out: "plugins/core/messaging/chain-messaging/chain-messaging.js",
|
||||
},
|
||||
{
|
||||
in: "plugins/core/messaging/q-chat/q-chat.src.js",
|
||||
out: "plugins/core/messaging/q-chat/q-chat.js",
|
||||
},
|
||||
{
|
||||
in: "plugins/core/minting/minting-info.src.js",
|
||||
out: "plugins/core/minting/minting-info.js",
|
||||
},
|
||||
{
|
||||
in: "plugins/core/puzzles/puzzles.src.js",
|
||||
out: "plugins/core/puzzles/puzzles.js",
|
||||
}
|
||||
].map((file) => {
|
||||
return generateRollupConfig(
|
||||
path.join(__dirname, file.in),
|
||||
path.join(__dirname, file.out)
|
||||
);
|
||||
});
|
||||
return configs;
|
||||
const configs = [
|
||||
{
|
||||
in: 'plugins/core/main.src.js',
|
||||
out: 'plugins/core/main.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/trade-portal/trade-portal.src.js',
|
||||
out: 'plugins/core/trade-portal/trade-portal.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/wallet/wallet-app.src.js',
|
||||
out: 'plugins/core/wallet/wallet-app.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/reward-share/reward-share.src.js',
|
||||
out: 'plugins/core/reward-share/reward-share.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/node-management/node-management.src.js',
|
||||
out: 'plugins/core/node-management/node-management.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/group-management/group-management.src.js',
|
||||
out: 'plugins/core/group-management/group-management.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/name-registration/name-registration.src.js',
|
||||
out: 'plugins/core/name-registration/name-registration.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/qdn/websites.src.js',
|
||||
out: 'plugins/core/qdn/websites.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/qdn/publish/publish.src.js',
|
||||
out: 'plugins/core/qdn/publish/publish.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/qdn/browser/browser.src.js',
|
||||
out: 'plugins/core/qdn/browser/browser.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/qdn/data-management/data-management.src.js',
|
||||
out: 'plugins/core/qdn/data-management/data-management.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/messaging/messaging.src.js',
|
||||
out: 'plugins/core/messaging/messaging.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/messaging/chain-messaging/chain-messaging.src.js',
|
||||
out: 'plugins/core/messaging/chain-messaging/chain-messaging.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/messaging/q-chat/q-chat.src.js',
|
||||
out: 'plugins/core/messaging/q-chat/q-chat.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/minting/minting-info.src.js',
|
||||
out: 'plugins/core/minting/minting-info.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/become-minter/become-minter.src.js',
|
||||
out: 'plugins/core/become-minter/become-minter.js',
|
||||
},
|
||||
{
|
||||
in: 'plugins/core/puzzles/puzzles.src.js',
|
||||
out: 'plugins/core/puzzles/puzzles.js',
|
||||
},
|
||||
].map((file) => {
|
||||
return generateRollupConfig(
|
||||
path.join(__dirname, file.in),
|
||||
path.join(__dirname, file.out)
|
||||
);
|
||||
});
|
||||
return configs;
|
||||
};
|
||||
|
||||
module.exports = generateForPlugins;
|
||||
|
@ -1,132 +1,143 @@
|
||||
import { parentEpml } from './connect.js'
|
||||
import './streams/streams.js'
|
||||
|
||||
let config = {}
|
||||
let haveRegisteredNodeManagement = false
|
||||
import { parentEpml } from './connect.js';
|
||||
import './streams/streams.js';
|
||||
|
||||
let config = {};
|
||||
let haveRegisteredNodeManagement = false;
|
||||
|
||||
parentEpml.ready().then(() => {
|
||||
// pluginUrlsConf
|
||||
let pluginUrlsConf = [
|
||||
{
|
||||
url: 'minting',
|
||||
domain: 'core',
|
||||
page: 'minting/index.html',
|
||||
title: 'Minting Details',
|
||||
icon: 'vaadin:info-circle',
|
||||
menus: [],
|
||||
parent: false
|
||||
},
|
||||
{
|
||||
url: 'wallet',
|
||||
domain: 'core',
|
||||
page: 'wallet/index.html',
|
||||
title: 'Wallet',
|
||||
icon: 'vaadin:wallet',
|
||||
menus: [],
|
||||
parent: false
|
||||
},
|
||||
{
|
||||
url: 'trade-portal',
|
||||
domain: 'core',
|
||||
page: 'trade-portal/index.html',
|
||||
title: 'Trade Portal',
|
||||
icon: 'vaadin:bullets',
|
||||
menus: [],
|
||||
parent: false
|
||||
},
|
||||
{
|
||||
url: 'reward-share',
|
||||
domain: 'core',
|
||||
page: 'reward-share/index.html',
|
||||
title: 'Reward Share',
|
||||
icon: 'vaadin:share-square',
|
||||
menus: [],
|
||||
parent: false
|
||||
},
|
||||
{
|
||||
url: 'name-registration',
|
||||
domain: 'core',
|
||||
page: 'name-registration/index.html',
|
||||
title: 'Name Registration',
|
||||
icon: 'vaadin:user-check',
|
||||
menus: [],
|
||||
parent: false
|
||||
},
|
||||
{
|
||||
url: 'websites',
|
||||
domain: 'core',
|
||||
page: 'qdn/index.html',
|
||||
title: 'Websites',
|
||||
icon: 'vaadin:desktop',
|
||||
menus: [],
|
||||
parent: false
|
||||
},
|
||||
{
|
||||
url: 'data-management',
|
||||
domain: 'core',
|
||||
page: 'qdn/data-management/index.html',
|
||||
title: 'Data Management',
|
||||
icon: 'vaadin:database',
|
||||
menus: [],
|
||||
parent: false
|
||||
},
|
||||
{
|
||||
url: 'q-chat',
|
||||
domain: 'core',
|
||||
page: 'messaging/q-chat/index.html',
|
||||
title: 'Q-Chat',
|
||||
icon: 'vaadin:chat',
|
||||
menus: [],
|
||||
parent: false
|
||||
},
|
||||
{
|
||||
url: 'group-management',
|
||||
domain: 'core',
|
||||
page: 'group-management/index.html',
|
||||
title: 'Group Management',
|
||||
icon: 'vaadin:group',
|
||||
menus: [],
|
||||
parent: false
|
||||
},
|
||||
{
|
||||
url: 'puzzles',
|
||||
domain: 'core',
|
||||
page: 'puzzles/index.html',
|
||||
title: 'Puzzles',
|
||||
icon: 'vaadin:puzzle-piece',
|
||||
menus: [],
|
||||
parent: false
|
||||
}
|
||||
]
|
||||
// pluginUrlsConf
|
||||
let pluginUrlsConf = [
|
||||
{
|
||||
url: 'minting',
|
||||
domain: 'core',
|
||||
page: 'minting/index.html',
|
||||
title: 'Minting Details',
|
||||
icon: 'vaadin:info-circle',
|
||||
menus: [],
|
||||
parent: false,
|
||||
},
|
||||
{
|
||||
url: 'become-minter',
|
||||
domain: 'core',
|
||||
page: 'become-minter/index.html',
|
||||
title: 'Become a Minter',
|
||||
icon: 'vaadin:info-circle',
|
||||
menus: [],
|
||||
parent: false,
|
||||
},
|
||||
{
|
||||
url: 'wallet',
|
||||
domain: 'core',
|
||||
page: 'wallet/index.html',
|
||||
title: 'Wallet',
|
||||
icon: 'vaadin:wallet',
|
||||
menus: [],
|
||||
parent: false,
|
||||
},
|
||||
{
|
||||
url: 'trade-portal',
|
||||
domain: 'core',
|
||||
page: 'trade-portal/index.html',
|
||||
title: 'Trade Portal',
|
||||
icon: 'vaadin:bullets',
|
||||
menus: [],
|
||||
parent: false,
|
||||
},
|
||||
{
|
||||
url: 'reward-share',
|
||||
domain: 'core',
|
||||
page: 'reward-share/index.html',
|
||||
title: 'Reward Share',
|
||||
icon: 'vaadin:share-square',
|
||||
menus: [],
|
||||
parent: false,
|
||||
},
|
||||
{
|
||||
url: 'name-registration',
|
||||
domain: 'core',
|
||||
page: 'name-registration/index.html',
|
||||
title: 'Name Registration',
|
||||
icon: 'vaadin:user-check',
|
||||
menus: [],
|
||||
parent: false,
|
||||
},
|
||||
{
|
||||
url: 'websites',
|
||||
domain: 'core',
|
||||
page: 'qdn/index.html',
|
||||
title: 'Websites',
|
||||
icon: 'vaadin:desktop',
|
||||
menus: [],
|
||||
parent: false,
|
||||
},
|
||||
{
|
||||
url: 'data-management',
|
||||
domain: 'core',
|
||||
page: 'qdn/data-management/index.html',
|
||||
title: 'Data Management',
|
||||
icon: 'vaadin:database',
|
||||
menus: [],
|
||||
parent: false,
|
||||
},
|
||||
{
|
||||
url: 'q-chat',
|
||||
domain: 'core',
|
||||
page: 'messaging/q-chat/index.html',
|
||||
title: 'Q-Chat',
|
||||
icon: 'vaadin:chat',
|
||||
menus: [],
|
||||
parent: false,
|
||||
},
|
||||
{
|
||||
url: 'group-management',
|
||||
domain: 'core',
|
||||
page: 'group-management/index.html',
|
||||
title: 'Group Management',
|
||||
icon: 'vaadin:group',
|
||||
menus: [],
|
||||
parent: false,
|
||||
},
|
||||
{
|
||||
url: 'puzzles',
|
||||
domain: 'core',
|
||||
page: 'puzzles/index.html',
|
||||
title: 'Puzzles',
|
||||
icon: 'vaadin:puzzle-piece',
|
||||
menus: [],
|
||||
parent: false,
|
||||
},
|
||||
];
|
||||
|
||||
const registerPlugins = (pluginInfo) => {
|
||||
parentEpml.request('registerUrl', pluginInfo)
|
||||
}
|
||||
const registerPlugins = (pluginInfo) => {
|
||||
parentEpml.request('registerUrl', pluginInfo);
|
||||
};
|
||||
|
||||
const checkNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||
const checkNode =
|
||||
window.parent.reduxStore.getState().app.nodeConfig.knownNodes[
|
||||
window.parent.reduxStore.getState().app.nodeConfig.node
|
||||
];
|
||||
|
||||
parentEpml.subscribe('config', c => {
|
||||
config = JSON.parse(c)
|
||||
parentEpml.subscribe('config', (c) => {
|
||||
config = JSON.parse(c);
|
||||
|
||||
// Only register node management if node management is enabled and it hasn't already been registered
|
||||
if (!haveRegisteredNodeManagement && checkNode.enableManagement) {
|
||||
haveRegisteredNodeManagement = true
|
||||
// Only register node management if node management is enabled and it hasn't already been registered
|
||||
if (!haveRegisteredNodeManagement && checkNode.enableManagement) {
|
||||
haveRegisteredNodeManagement = true;
|
||||
|
||||
let nodeManagementConf = {
|
||||
url: 'node-management',
|
||||
domain: 'core',
|
||||
page: 'node-management/index.html',
|
||||
title: 'Node Management',
|
||||
icon: 'vaadin:cloud',
|
||||
menus: [],
|
||||
parent: false
|
||||
}
|
||||
let nodeManagementConf = {
|
||||
url: 'node-management',
|
||||
domain: 'core',
|
||||
page: 'node-management/index.html',
|
||||
title: 'Node Management',
|
||||
icon: 'vaadin:cloud',
|
||||
menus: [],
|
||||
parent: false,
|
||||
};
|
||||
|
||||
let _pluginUrlsConf = [...pluginUrlsConf, nodeManagementConf]
|
||||
registerPlugins(_pluginUrlsConf)
|
||||
} else {
|
||||
registerPlugins(pluginUrlsConf)
|
||||
}
|
||||
})
|
||||
})
|
||||
let _pluginUrlsConf = [...pluginUrlsConf, nodeManagementConf];
|
||||
registerPlugins(_pluginUrlsConf);
|
||||
} else {
|
||||
registerPlugins(pluginUrlsConf);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user