mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-14 09:48:10 -05:00
Update index.js
This commit is contained in:
@@ -115,7 +115,7 @@ exports.get_card = function(req, res) {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getCalls(req, res, next) {
|
async function getCalls(req, res, next) {
|
||||||
|
|
||||||
if (req.query && req.query["call-id"]) {
|
if (req.query && req.query["call-id"]) {
|
||||||
|
|
||||||
@@ -126,26 +126,34 @@ function getCalls(req, res, next) {
|
|||||||
next()
|
next()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
db.get().collection('calls', function (err, transCollection) {
|
db.get().collection('calls', function (err, transCollection) {
|
||||||
transCollection.findOne({
|
transCollection.findOne({
|
||||||
'_id': o_id
|
'_id': o_id
|
||||||
},
|
},
|
||||||
function (err, item) {
|
async function (err, item) {
|
||||||
if (item) {
|
if (item) {
|
||||||
var time = new Date(item.time);
|
var time = new Date(item.time);
|
||||||
var timeString = time.toLocaleTimeString("en-US");
|
var timeString = time.toLocaleTimeString("en-US");
|
||||||
var dateString = time.toDateString();
|
var dateString = time.toDateString();
|
||||||
//console.log(item)
|
//console.log(item)
|
||||||
|
const tg_coll = db.get().collection('talkgroups');
|
||||||
|
const tg = await tg_coll.findOne({ "num": item.talkgroupNum, 'shortName': req.params.shortName.toLowerCase()})
|
||||||
|
var title = item.len + " second transmission"
|
||||||
|
|
||||||
|
if (tg) {
|
||||||
|
console.log(tg)
|
||||||
|
title = tg.description;
|
||||||
|
}
|
||||||
const callId = req.query["call-id"];
|
const callId = req.query["call-id"];
|
||||||
const callUrl = "https://s3.us-west-1.wasabisys.com/openmhz-west/media/dcfd-1039-1613917169.m4a"
|
const callUrl = "https://s3.us-west-1.wasabisys.com/openmhz-west/media/dcfd-1039-1613917169.m4a"
|
||||||
const twitterMeta = `
|
const twitterMeta = `
|
||||||
<meta name="twitter:card" content="player"/>
|
<meta name="twitter:card" content="player"/>
|
||||||
<meta name="twitter:site" content="@openmhz"/>
|
<meta name="twitter:site" content="@openmhz"/>
|
||||||
|
|
||||||
<meta name="twitter:title" content="Call at ${timeString} ${dateString} "/>
|
<meta name="twitter:title" content="${title}"/>
|
||||||
<meta name="twitter:description" content="This is a call from talkgroup" />
|
<meta name="twitter:description" content="${timeString} ${dateString}" />
|
||||||
<meta name="twitter:image" content="https://openmhz.com/radio-400x400.jpg"/>
|
<meta name="twitter:image" content="https://openmhz.com/radio-400x400.jpg"/>
|
||||||
<meta name="twitter:player" content="${process.env['REACT_APP_FRONTEND_SERVER']}/cards/${callId}"/>
|
<meta name="twitter:player" content="${process.env['REACT_APP_FRONTEND_SERVER']}/cards/${callId}"/>
|
||||||
<meta name="twitter:player:stream" content="${item.url}"/>
|
<meta name="twitter:player:stream" content="${item.url}"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user