mirror of
https://github.com/slynn1324/tinypin.git
synced 2026-01-23 02:25:08 +00:00
added version
This commit is contained in:
parent
fae2abe466
commit
d01ec3fdcc
2 changed files with 6 additions and 6 deletions
11
server.js
11
server.js
|
|
@ -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
1
version.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
none
|
||||
Loading…
Add table
Add a link
Reference in a new issue