This commit is contained in:
holmityd 2023-09-21 14:54:29 +04:00
parent 114a9ef8bb
commit 7dd82841ef
2 changed files with 15 additions and 4 deletions

View File

@ -1,18 +1,19 @@
import express from "express"; import express from "express";
import config from "@/config.json"; import config from "@/config.json";
import { join } from "path";
const cacheRouter = express.Router(); const cacheRouter = express.Router();
cacheRouter.get("/B.Cache.Dx11.bin.*", (_req, res) => { cacheRouter.get("/B.Cache.Dx11.bin.*", (_req, res) => {
res.sendFile("static/data/B.Cache.Dx11_33.0.6.bin", { root: "./" }); res.sendFile(join(__dirname, "../../static/data/B.Cache.Dx11_33.0.6.bin"));
}); });
cacheRouter.get("/B.Cache.Windows_en.bin*", (_req, res) => { cacheRouter.get("/B.Cache.Windows_en.bin*", (_req, res) => {
res.sendFile("static/data/B.Cache.Windows_en_33.0.10.bin", { root: "./" }); res.sendFile(join(__dirname, "../../static/data/B.Cache.Windows_en_33.0.10.bin"));
}); });
cacheRouter.get(/^\/origin\/[a-zA-Z0-9]+\/[0-9]+\/H\.Cache\.bin.*$/, (_req, res) => { cacheRouter.get(/^\/origin\/[a-zA-Z0-9]+\/[0-9]+\/H\.Cache\.bin.*$/, (_req, res) => {
res.sendFile(`static/data/H.Cache_${config.version}.bin`, { root: "./" }); res.sendFile(join(__dirname, `../../static/data/H.Cache_${config.version}.bin`));
}); });
export { cacheRouter }; export { cacheRouter };

View File

@ -4,6 +4,7 @@ const webpack = require("webpack");
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin"); const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin"); const CopyPlugin = require("copy-webpack-plugin");
const Dotenv = require("dotenv-webpack"); const Dotenv = require("dotenv-webpack");
const config = require("./config.json");
module.exports = { module.exports = {
target: "node", target: "node",
@ -18,7 +19,7 @@ module.exports = {
ejs: "ejs" ejs: "ejs"
}), }),
new CopyPlugin({ new CopyPlugin({
patterns: [{ from: "static/certs/", to: "certs/" }] patterns: [{ from: "static/certs/", to: "certs/" }, `static/data/H.Cache_${config.version}.bin`]
}) })
], ],
module: { module: {
@ -28,6 +29,15 @@ module.exports = {
use: "ts-loader", use: "ts-loader",
exclude: /node_modules/ exclude: /node_modules/
}, },
{
test: /cache\.ts$/,
loader: "string-replace-loader",
options: {
search: "../../static/data/",
replace: "./",
flags: "g"
}
},
{ {
test: /index\.ts$/, test: /index\.ts$/,
loader: "string-replace-loader", loader: "string-replace-loader",