mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-14 17:58:02 -05:00
debugged
This commit is contained in:
@@ -13,7 +13,7 @@ exports.isLoggedIn = function (req, res, next) {
|
|||||||
|
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
exports.listUserSystems = async function (req,res,next) {
|
exports.listUserSystems = async function (req, res, next) {
|
||||||
if (!req.user.admin) {
|
if (!req.user.admin) {
|
||||||
res.status(401);
|
res.status(401);
|
||||||
res.json({ success: false, message: "Not Authorized" });
|
res.json({ success: false, message: "Not Authorized" });
|
||||||
@@ -36,9 +36,9 @@ exports.listUserSystems = async function (req,res,next) {
|
|||||||
|
|
||||||
exports.listAllSystems = async function (req, res, next) {
|
exports.listAllSystems = async function (req, res, next) {
|
||||||
if (!req.user.admin) {
|
if (!req.user.admin) {
|
||||||
res.status(401);
|
res.status(401);
|
||||||
res.json({ success: false, message: "Not Authorized" });
|
res.json({ success: false, message: "Not Authorized" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const systems = await System.find().exec();
|
const systems = await System.find().exec();
|
||||||
@@ -61,6 +61,7 @@ exports.listAllSystems = async function (req, res, next) {
|
|||||||
userId,
|
userId,
|
||||||
key,
|
key,
|
||||||
showScreenName,
|
showScreenName,
|
||||||
|
allowContact,
|
||||||
ignoreUnknownTalkgroup,
|
ignoreUnknownTalkgroup,
|
||||||
lastActive,
|
lastActive,
|
||||||
active
|
active
|
||||||
@@ -76,6 +77,7 @@ exports.listAllSystems = async function (req, res, next) {
|
|||||||
userId,
|
userId,
|
||||||
key,
|
key,
|
||||||
showScreenName,
|
showScreenName,
|
||||||
|
allowContact,
|
||||||
ignoreUnknownTalkgroup,
|
ignoreUnknownTalkgroup,
|
||||||
lastActive,
|
lastActive,
|
||||||
active
|
active
|
||||||
@@ -311,6 +313,8 @@ exports.uniqueShortName = async function (req, res, next) {
|
|||||||
|
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
|
// All the values you want to use here need to be copied over in validateSystem()
|
||||||
|
|
||||||
exports.updateSystem = async function (req, res, next) {
|
exports.updateSystem = async function (req, res, next) {
|
||||||
|
|
||||||
res.locals.system.name = res.locals.name;
|
res.locals.system.name = res.locals.name;
|
||||||
@@ -375,6 +379,7 @@ exports.validateSystem = async function (req, res, next) {
|
|||||||
try {
|
try {
|
||||||
res.locals.showScreenName = req.body.showScreenName;
|
res.locals.showScreenName = req.body.showScreenName;
|
||||||
res.locals.ignoreUnknownTalkgroup = req.body.ignoreUnknownTalkgroup;
|
res.locals.ignoreUnknownTalkgroup = req.body.ignoreUnknownTalkgroup;
|
||||||
|
res.locals.allowContact = req.body.allowContact;
|
||||||
if (!req.body.name || (req.body.name.length < 2)) {
|
if (!req.body.name || (req.body.name.length < 2)) {
|
||||||
console.error("ERROR: Validate System - req.body.name");
|
console.error("ERROR: Validate System - req.body.name");
|
||||||
res.status(500)
|
res.status(500)
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ const SystemForm = (props) => {
|
|||||||
county,
|
county,
|
||||||
country,
|
country,
|
||||||
showScreenName,
|
showScreenName,
|
||||||
|
allowContact,
|
||||||
ignoreUnknownTalkgroup
|
ignoreUnknownTalkgroup
|
||||||
};
|
};
|
||||||
props.onSubmit(system);
|
props.onSubmit(system);
|
||||||
|
|||||||
@@ -79,10 +79,14 @@ exports.contact_system = async function(req, res) {
|
|||||||
});
|
});
|
||||||
request.then(result => {
|
request.then(result => {
|
||||||
console.log(`User Comment sent to: ${user.email} for shortName: ${system.shortName}`)
|
console.log(`User Comment sent to: ${user.email} for shortName: ${system.shortName}`)
|
||||||
|
res.json({
|
||||||
|
success: true
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err.statusCode);
|
console.error(err.statusCode);
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
res.status(500);
|
||||||
res.json({
|
res.json({
|
||||||
success: false,
|
success: false,
|
||||||
message: err
|
message: err
|
||||||
@@ -97,6 +101,7 @@ exports.get_systems = async function (req, res) {
|
|||||||
let fromDate = new Date(Date.now() - 60 * 60 * 24 * 30 * 1000);
|
let fromDate = new Date(Date.now() - 60 * 60 * 24 * 30 * 1000);
|
||||||
const results = await System.find({lastActive: {$gte: fromDate}}).populate('userId', "screenName").catch( err => {
|
const results = await System.find({lastActive: {$gte: fromDate}}).populate('userId', "screenName").catch( err => {
|
||||||
console.error("Error - get_systems: " + err.message);
|
console.error("Error - get_systems: " + err.message);
|
||||||
|
res.status(500);
|
||||||
res.json({
|
res.json({
|
||||||
success: false,
|
success: false,
|
||||||
message: err
|
message: err
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
Modal,
|
Modal,
|
||||||
Button,
|
Button,
|
||||||
Icon,
|
Icon,
|
||||||
Label,
|
List,
|
||||||
Form,
|
Form,
|
||||||
Grid
|
Grid
|
||||||
} from "semantic-ui-react";
|
} from "semantic-ui-react";
|
||||||
@@ -35,7 +35,7 @@ function ContactModal(props) {
|
|||||||
setName(false);
|
setName(false);
|
||||||
setEmail(false);
|
setEmail(false);
|
||||||
setMessage(false);
|
setMessage(false);
|
||||||
//onClose();
|
onClose();
|
||||||
} catch (submitError) {
|
} catch (submitError) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
setError(submitError);
|
setError(submitError);
|
||||||
@@ -55,7 +55,17 @@ function ContactModal(props) {
|
|||||||
<Grid columns={2} divided>
|
<Grid columns={2} divided>
|
||||||
<Grid.Row>
|
<Grid.Row>
|
||||||
<Grid.Column width={6}>
|
<Grid.Column width={6}>
|
||||||
Stuf about what to do
|
<p>The radio systems on OpenMHz are contributed by people from around the world.</p> <p>Use this form to contact the contributer for the <span style={{fontWeight: "bold"}}>{system.name}</span> system regarding:
|
||||||
|
<List as='ul'>
|
||||||
|
<List.Item as='li'>Outages</List.Item>
|
||||||
|
<List.Item as='li'>Audio quality</List.Item>
|
||||||
|
<List.Item as='li'>Talkgroup updates</List.Item>
|
||||||
|
<List.Item as='li'>Thanks & appreciation</List.Item>
|
||||||
|
</List>
|
||||||
|
</p>
|
||||||
|
<p>If you have general questions about OpenMHz send me an email, </p>
|
||||||
|
<p> - Luke <a href="mailto:luke@robotastic.com?Subject=OpenMHz" target="_top">luke@robotastic.com</a> </p>
|
||||||
|
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
<Grid.Column width={10}>
|
<Grid.Column width={10}>
|
||||||
<Form>
|
<Form>
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ function SystemCard (props) {
|
|||||||
<Grid.Row>
|
<Grid.Row>
|
||||||
<Grid.Column >
|
<Grid.Column >
|
||||||
{system.screenName && <Label size="mini"><Icon name='user' /> {system.screenName}</Label>}
|
{system.screenName && <Label size="mini"><Icon name='user' /> {system.screenName}</Label>}
|
||||||
<Label size="mini" onClick={handleContactClick}><Icon name='mail' />Mail</Label>
|
{/*system.allowContact && <Label size="mini" onClick={handleContactClick}><Icon name='mail' />Message</Label>*/}
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
</Grid.Row>
|
</Grid.Row>
|
||||||
<Grid.Row>
|
<Grid.Row>
|
||||||
|
|||||||
Reference in New Issue
Block a user