constexpress=require("express");constpath=require("path");constfs=require("fs");constmulter=require("multer");constPORT=process.env.port||3000constapp=express();global="global"app.listen(PORT,()=>{console.log(`listen at ${PORT}`);});functionmerge(target,source){for(letkeyinsource){if(keyinsource&&keyintarget){merge(target[key],source[key])}else{target[key]=source[key]}}}letobjMulter=multer({dest:"./upload"});app.use(objMulter.any());app.use(express.static("./public"));app.post("/upload",(req,res)=>{try{letoldName=req.files[0].path;letnewName=req.files[0].path+path.parse(req.files[0].originalname).ext;fs.renameSync(oldName,newName);res.send({err:0,url:"./upload/"+req.files[0].filename+path.parse(req.files[0].originalname).ext});}catch(error){res.send(require('./err.js').getRandomErr())}});app.post('/pollution',require('body-parser').json(),(req,res)=>{letdata={};try{merge(data,req.body);res.send('Register successfully!tql')require('./err.js').getRandomErr()}catch(error){res.send(require('./err.js').getRandomErr())}})
// This file is a bit weird, so let me explain with some context: we're working
// to implement a tool called "Corepack" in Node. This tool will allow us to
// provide a Yarn shim to everyone using Node, meaning that they won't need to
// run `npm install -g yarn`.
//
// Still, we don't want to break the experience of people that already use `npm
// install -g yarn`! And one annoying thing with npm is that they install their
// binaries directly inside the Node bin/ folder. And Because of this, they
// refuse to overwrite binaries when they detect they don't belong to npm. Which
// means that, since the "yarn" Corepack symlink belongs to Corepack and not npm,
// running `npm install -g yarn` would crash by refusing to override the binary :/
//
// And thus we have this preinstall script, which checks whether Yarn is being
// installed as a global binary, and remove the existing symlink if it detects
// it belongs to Corepack. Since preinstall scripts run, in npm, before the global
// symlink is created, we bypass this way the ownership check.
//
// More info:
// https://github.com/arcanis/pmm/issues/6
if(process.env.npm_config_global){varcp=require('child_process');varfs=require('fs');varpath=require('path');try{vartargetPath=cp.execFileSync(process.execPath,[process.env.npm_execpath,'bin','-g'],{encoding:'utf8',stdio:['ignore',undefined,'ignore'],}).replace(/\n/g,'');varmanifest=require('./package.json');varbinNames=typeofmanifest.bin==='string'?[manifest.name.replace(/^@[^\/]+\//,'')]:typeofmanifest.bin==='object'&&manifest.bin!==null?Object.keys(manifest.bin):[];binNames.forEach(function(binName){varbinPath=path.join(targetPath,binName);varbinTarget;try{binTarget=fs.readlinkSync(binPath);}catch(err){return;}if(binTarget.startsWith('../lib/node_modules/corepack/')){try{fs.unlinkSync(binPath);}catch(err){return;}}});}catch(err){// ignore errors
}}