feat: support default game maps
This commit is contained in:
parent
76d825f9c5
commit
2248123b61
2 changed files with 5 additions and 4 deletions
|
@ -151,8 +151,9 @@ router.post("/upload_site", isUser, async (req, res) => {
|
|||
|
||||
fs.writeFileSync(file, course);
|
||||
|
||||
const mapid = fields.link.match(/id=(\d+)/)[1];
|
||||
const mapImage = await openGraphScraper({ url: `https://steamcommunity.com/sharedfiles/filedetails/?id=${mapid}` }).then(data => data.result.ogImage[0].url);
|
||||
const matched = fields.link.match(/id=(\d+)/);
|
||||
const mapid = matched ? matched[1] : null;
|
||||
const mapImage = mapid ? await openGraphScraper({ url: `https://steamcommunity.com/sharedfiles/filedetails/?id=${mapid}` }).then(data => data.result.ogImage[0].url) : "";
|
||||
|
||||
await db.push("/courses", {
|
||||
[code]: {
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
<div style="margin-left: 13.5%; margin-right: 13.5%;">
|
||||
<form action="/api/upload_site" method="post" enctype="multipart/form-data" class="w-full font-mono max-w-sm">
|
||||
<div class="flex flex-col mt-4 space-y-2">
|
||||
<input type="text" id="courseMap" name="map" placeholder="Enter course map..." required class="input input-bordered" />
|
||||
<input type="url" id="mapLink" name="link" placeholder="Paste map link here..." required class="input input-bordered" />
|
||||
<input type="text" id="courseMap" name="map" placeholder="Map name that course uses" required class="input input-bordered" />
|
||||
<input type="url" id="mapLink" name="link" placeholder="Workshop link to the map or nothing" required class="input input-bordered" />
|
||||
<label class="form-control w-full">
|
||||
<input type="file" id="courseFile" name="file" accept=".txt" required class="file-input file-input-bordered" />
|
||||
<div class="label">
|
||||
|
|
Loading…
Add table
Reference in a new issue