added version

This commit is contained in:
slynn1324 2021-01-25 09:58:48 -06:00
parent fae2abe466
commit d01ec3fdcc
2 changed files with 6 additions and 6 deletions

View file

@ -2,7 +2,6 @@ const yargs = require('yargs');
const express = require('express');
const bodyParser = require('body-parser');
const betterSqlite3 = require('better-sqlite3');
// const db = require('better-sqlite3') //, {verbose:console.log});
const http = require('http');
const https = require('https');
const sharp = require('sharp');
@ -11,8 +10,6 @@ const path = require('path');
const fetch = require('node-fetch');
const crypto = require('crypto');
const cookieParser = require('cookie-parser');
const { send } = require('process');
const { SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION } = require('constants');
process.on('SIGINT', () => {
console.info('ctrl+c detected, exiting tinypin');
@ -26,6 +23,8 @@ process.on('SIGTERM', () => {
process.exit(0);
});
let VERSION = require('fs').readFileSync('version.txt', 'utf8');
const argv = yargs
.option('slow', {
alias: 's',
@ -60,6 +59,8 @@ const PORT = argv.port;
console.log('tinypin starting...');
console.log('');
console.log(`version: ${VERSION}`);
console.log('');
console.log('configuration:');
console.log(` port: ${PORT}`);
console.log(` database path: ${DB_PATH}`);
@ -217,7 +218,6 @@ app.use ( async (req, res, next) => {
// handle image serving, injecting the user id in the path to segregate users and control cross-user resource access
app.use( (req, res, next) => {
if ( req.method == "GET" && req.originalUrl.startsWith("/images/") ){
let filepath = IMAGE_PATH + '/' + req.user.id + '/' + req.originalUrl;
@ -227,7 +227,6 @@ app.use( (req, res, next) => {
} else {
next();
}
});
app.use(express.static('static'));
@ -249,7 +248,7 @@ const SERVER_ERROR = {status: "error", error: "server error"};
app.get("/api/whoami", (req, res) => {
res.send({name: req.user.name});
res.send({name: req.user.name, version: VERSION});
});
// list boards

1
version.txt Normal file
View file

@ -0,0 +1 @@
none