OBS widget that implements a countdown timer overlay for "Starting Soon..." style displays.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

61 lines
1.8 KiB

'use strict';
const path = require('path');
const express = require('express');
const multer = require('multer');
module.postCreateCountdown = async (req, res, next) => {
const date = req.body.date.split('-');
const time = req.body.time.split(':');
res.locals.params = {
show: {
title: req.body.title,
url: req.body.url,
},
year: date[0],
month: date[1],
date: date[2],
hours: time[0],
minutes: time[1],
};
res.render('countdown/created');
};
module.getTimerView = async (req, res) => {
res.render('countdown/timer');
};
module.getHomeView = async (req, res) => {
res.render('index');
};
(async ( ) => {
module.app = express();
module.app.locals.moment = require('moment');
module.app.locals.numeral = require('numeral');
module.app.set('view engine', 'pug');
module.app.set('views', path.join(__dirname, 'app', 'views'));
module.app.use('/uikit', express.static(path.join(__dirname, "node_modules", "uikit", "dist")));
module.app.use('/moment', express.static(path.join(__dirname, "node_modules", "moment", "min")));
module.app.use('/numeral', express.static(path.join(__dirname, "node_modules", "numeral", "min")));
module.app.use('/fonts', express.static(path.join(__dirname, 'client', 'fonts')));
module.app.use('/css', express.static(path.join(__dirname, 'client', 'css')));
module.app.use(express.urlencoded({ extended: true }));
const upload = multer();
module.app.post('/', upload.none(), module.postCreateCountdown);
module.app.get('/timer', module.getTimerView);
module.app.get('/', module.getHomeView);
module.app.listen(8000, ( ) => {
console.log('Countdown online');
});
})();