1.1.3 - display version info

This commit is contained in:
May 2022-12-27 11:52:11 -08:00
parent 5387843241
commit 362f1a158f
6 changed files with 15 additions and 11 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "monofile", "name": "monofile",
"version": "1.1.1", "version": "1.1.3",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View file

@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>monofile</title> <title>monofile</title>
<meta name="og:site_name" content="$Version">
<meta name="application-name" content="monofile"> <meta name="application-name" content="monofile">
<meta name="description" content="Discord-based filesharing"> <meta name="description" content="Discord-based filesharing">
@ -79,7 +80,7 @@
<input type="text" id="CopyTB" value="" readonly style="opacity:0;width:10px;height:0%;"> <input type="text" id="CopyTB" value="" readonly style="opacity:0;width:10px;height:0%;">
<div id="content"> <div id="content">
<h1> <h1>
monofile monofile<span style="font-style:italic;font-weight:bold;font-size:16px;color:#999999"> $Version</span>
</h1> </h1>
<h2><em>Discord-based file sharing</em></h2> <h2><em>Discord-based file sharing</em></h2>
<div class="note" style="border-color:#FFAAAAFF;background-color:#FFAAAA66"> <div class="note" style="border-color:#FFAAAAFF;background-color:#FFAAAA66">

View file

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>monofile</title> <title>monofile</title>
<meta name="og:site_name" content="monofile"> <meta name="og:site_name" content="monofile $Version">
<meta name="title" content="$FileName"> <meta name="title" content="$FileName">
<meta name="description" content="ID: $FileId"> <meta name="description" content="ID: $FileId">

View file

@ -5,8 +5,9 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="application-name" content="Error"> <meta name="og:site_name" content="monofile $Version">
<meta name="description" content="Monofile - Discord-based filesharing"> <meta name="application-name" content="$ErrorCode">
<meta name="description" content="$ErrorMessage">
<title>monofile</title> <title>monofile</title>
@ -57,7 +58,7 @@
<body> <body>
<div id="content"> <div id="content">
<h1> <h1>
monofile monofile<span style="font-style:italic;font-weight:bold;font-size:16px;color:#999999"> $Version</span>
</h1> </h1>
<h2><em>Discord-based file sharing</em></h2> <h2><em>Discord-based file sharing</em></h2>
<div class="note" style="border-color:#FFAAAAFF;background-color:#FFAAAA66"> <div class="note" style="border-color:#FFAAAAFF;background-color:#FFAAAA66">

View file

@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>monofile</title> <title>monofile</title>
<meta name="og:site_name" content="$Version">
<meta name="application-name" content="monofile"> <meta name="application-name" content="monofile">
<meta name="description" content="Discord-based filesharing"> <meta name="description" content="Discord-based filesharing">
@ -79,7 +80,7 @@
<input type="text" id="CopyTB" value="" readonly style="opacity:0;width:10px;height:0%;"> <input type="text" id="CopyTB" value="" readonly style="opacity:0;width:10px;height:0%;">
<div id="content"> <div id="content">
<h1> <h1>
monofile monofile<span style="font-style:italic;font-weight:bold;font-size:16px;color:#999999"> $Version</span>
</h1> </h1>
<h2><em>Discord-based file sharing</em></h2> <h2><em>Discord-based file sharing</em></h2>
<div class="note" style="border-color:#FFAAAAFF;background-color:#FFAAAA66"> <div class="note" style="border-color:#FFAAAAFF;background-color:#FFAAAA66">

View file

@ -6,6 +6,7 @@ import fs from "fs"
import axios, { AxiosResponse } from "axios" import axios, { AxiosResponse } from "axios"
require('dotenv').config() require('dotenv').config()
let pkg = require(`${process.cwd()}/package.json`)
let app = express() let app = express()
@ -21,7 +22,7 @@ function ThrowError(response:express.Response,code:number,errorMessage:string) {
fs.readFile(__dirname+"/../pages/error.html",(err,buf) => { fs.readFile(__dirname+"/../pages/error.html",(err,buf) => {
if (err) {response.sendStatus(500);console.log(err);return} if (err) {response.sendStatus(500);console.log(err);return}
response.status(code) response.status(code)
response.send(buf.toString().replace("$ErrorCode",code.toString()).replace("$ErrorMessage",errorMessage)) response.send(buf.toString().replace(/\$ErrorCode/g,code.toString()).replace(/\$ErrorMessage/g,errorMessage).replace(/\$Version/g,pkg.version))
}) })
} }
@ -103,14 +104,14 @@ let uploadFile = (settings:FileUploadSettings,fBuffer:Buffer) => {
app.get("/", function(req,res) { app.get("/", function(req,res) {
fs.readFile(__dirname+"/../pages/upload.html",(err,buf) => { fs.readFile(__dirname+"/../pages/upload.html",(err,buf) => {
if (err) {res.sendStatus(500);console.log(err);return} if (err) {res.sendStatus(500);console.log(err);return}
res.send(buf.toString().replace("$MaxInstanceFilesize",`${(config.maxDiscordFileSize*config.maxDiscordFiles)/1048576}MB`)) res.send(buf.toString().replace("$MaxInstanceFilesize",`${(config.maxDiscordFileSize*config.maxDiscordFiles)/1048576}MB`).replace(/\$Version/g,pkg.version))
}) })
}) })
app.get("/clone", function(req,res) { app.get("/clone", function(req,res) {
fs.readFile(__dirname+"/../pages/clone.html",(err,buf) => { fs.readFile(__dirname+"/../pages/clone.html",(err,buf) => {
if (err) {res.sendStatus(500);console.log(err);return} if (err) {res.sendStatus(500);console.log(err);return}
res.send(buf.toString().replace("$MaxInstanceFilesize",`${(config.maxDiscordFileSize*config.maxDiscordFiles)/1048576}MB`)) res.send(buf.toString().replace("$MaxInstanceFilesize",`${(config.maxDiscordFileSize*config.maxDiscordFiles)/1048576}MB`).replace(/\$Version/g,pkg.version))
}) })
}) })
@ -142,7 +143,7 @@ app.get("/download/:fileId",(req,res) => {
fs.readFile(__dirname+"/../pages/download.html",(err,buf) => { fs.readFile(__dirname+"/../pages/download.html",(err,buf) => {
if (err) {res.sendStatus(500);console.log(err);return} if (err) {res.sendStatus(500);console.log(err);return}
res.send(buf.toString().replace(/\$FileName/g,file.filename).replace(/\$FileId/g,req.params.fileId)) res.send(buf.toString().replace(/\$FileName/g,file.filename).replace(/\$FileId/g,req.params.fileId).replace(/\$Version/g,pkg.version))
}) })
} else { } else {
ThrowError(res,404,"File not found. <a href=\"javascript:history.back()\">Back</a> <a href=\"/\">Home</a>") ThrowError(res,404,"File not found. <a href=\"javascript:history.back()\">Back</a> <a href=\"/\">Home</a>")