remove ui

This commit is contained in:
undefined committed 2020-07-19 13:31:56 +08:00
1 parent 9dd370fa72
commit 87123659aa
546 files changed
+180 -33522

No files matched your search

-51
View File
@@ -1,51 +0,0 @@
const fs = require('fs');
const path = require('path');
module.exports = {
formidable: () => {
const tasks = ['incoming_form', 'file', 'json_parser', 'querystring_parser'];
for (const task of tasks) {
const p = require.resolve(`formidable/lib/${task}`);
const file = fs.readFileSync(p).toString().split('\n');
if (file[0].includes('if (global.GENTLY) require = GENTLY.hijack(require);')) {
file[0] = '// Hacked';
fs.writeFileSync(p, file.join('\n'));
} else if (!file[0].includes('// Hacked')) {
console.error('Cannot hack formidable', task);
}
}
},
sockjs: () => {
const p = require.resolve('sockjs/lib/sockjs.js');
const file = fs.readFileSync(p).toString().split('\n');
if (file[139].includes('this.app.log')) {
file[139] = '// Hacked';
fs.writeFileSync(p, file.join('\n'));
} else if (!file[139].includes('// Hacked')) {
console.error('Cannot hack sockjs');
}
},
saslprep: () => {
const q = require.resolve('saslprep');
const mem = path.join(path.dirname(q), 'code-points.mem');
const p = path.join(path.dirname(q), 'lib', 'memory-code-points.js');
const data = fs.readFileSync(mem);
const file = fs.readFileSync(p).toString().split('\n');
if (file[7].includes('fs.readFileSync')) {
file[7] = `const memory = Buffer.from('${data.toString('base64')}', 'base64');`;
fs.writeFileSync(p, file.join('\n'));
} else if (!file[7].includes('Buffer.from')) {
console.error('Cannot hack saslprep');
}
},
ftp: () => {
const p = require.resolve('ftp/lib/connection');
const file = fs.readFileSync(p).toString().split('\n');
if (file[51].includes('new Buffer')) {
file[51] = file[51].replace('new Buffer', 'Buffer.from');
fs.writeFileSync(p, file.join('\n'));
} else if (!file[51].includes('Buffer.from')) {
console.error('Cannot hack ftp');
}
},
};
-20
View File
@@ -1,20 +0,0 @@
/* eslint-disable no-await-in-loop */
const path = require('path');
const fs = require('fs-extra');
const argv = require('yargs-parser')(process.argv.slice(2));
const hack = require('./hack');
async function build(type) {
if (!['development', 'production'].includes(type)) throw new Error(`Unknown type: ${type}`);
fs.ensureDirSync(path.resolve(__dirname, '..', '.build'));
for (const task in hack) hack[task]();
console.log('Build::Main');
await require('./webpack')(type);
console.log('Build::Resources');
require('./resource')(type);
}
build(argv.development ? 'development' : 'production').catch((e) => {
console.error(e);
process.exit(1);
});
-13
View File
@@ -1,13 +0,0 @@
const AdmZip = require('adm-zip');
function build() {
const zip = new AdmZip();
zip.addLocalFolder('public', 'public');
zip.addLocalFolder('locales', 'locales');
zip.addLocalFolder('templates', 'templates');
zip.addLocalFolder('wiki', 'wiki');
zip.addLocalFile('package.json');
zip.writeZip('.build/builtin.hydro');
}
module.exports = build;
-59
View File
@@ -1,59 +0,0 @@
/* eslint-disable import/no-extraneous-dependencies */
const path = require('path');
const webpack = require('webpack');
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
const build = async (type) => {
const config = {
mode: type,
entry: {
app: path.resolve(__dirname, '..', 'hydro', 'loader.ts'),
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, '..', '.build'),
},
target: 'node',
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'cache-loader',
options: {
cacheDirectory: path.resolve(__dirname, '..', '.cache', 'ts'),
},
},
'ts-loader',
],
},
],
},
node: {
__dirname: false,
},
resolve: { extensions: ['.js', '.ts'] },
plugins: [
new webpack.ProgressPlugin(),
new FriendlyErrorsPlugin({
clearConsole: false,
}),
],
};
const compiler = webpack(config);
await new Promise((resolve, reject) => {
compiler.run((err, stats) => {
if (err) {
console.error(err.stack || err);
if (err.details) console.error(err.details);
reject();
}
if (stats.hasErrors()) process.exitCode = 1;
resolve();
});
});
};
module.exports = build;