Mass-PDA perms is configured on Wirecarp (#66889)

Lawyers and Captains spawn by-default with the ability to send mass PDA messages, but the Wirecarp app (so Research Director and Captain) can grant/revoke permission to send PDAs to everyone
This commit is contained in:
John Willard
2022-05-17 00:35:08 -04:00
committed by GitHub
parent ca7f4c44d8
commit 5d58bebbf9
6 changed files with 277 additions and 130 deletions
@@ -77,7 +77,6 @@
circuit = /obj/item/circuitboard/machine/telecomms/message_server
var/list/datum/data_tablet_msg/pda_msgs = list()
var/list/datum/data_tablet_msg/modular_msgs = list()
var/list/datum/data_rc_msg/rc_msgs = list()
var/decryptkey = "password"
var/calibrating = 15 MINUTES //Init reads this and adds world.time, then becomes 0 when that time has passed and the machine works
@@ -26,6 +26,11 @@
/obj/item/modular_computer/tablet/pda/heads/captain/Initialize(mapload)
. = ..()
RegisterSignal(src, COMSIG_TABLET_CHECK_DETONATE, .proc/tab_no_detonate)
var/obj/item/computer_hardware/hard_drive/drive = all_components[MC_HDD]
if(!drive)
return
for(var/datum/computer_file/program/messenger/messenger_app in drive.stored_files)
messenger_app.spam_mode = TRUE
/obj/item/modular_computer/tablet/pda/heads/hop
name = "head of personnel PDA"
@@ -274,6 +279,14 @@
/datum/computer_file/program/records/security,
)
/obj/item/modular_computer/tablet/pda/lawyer/Initialize(mapload)
. = ..()
var/obj/item/computer_hardware/hard_drive/drive = all_components[MC_HDD]
if(!drive)
return
for(var/datum/computer_file/program/messenger/messenger_app in drive.stored_files)
messenger_app.spam_mode = TRUE
/obj/item/modular_computer/tablet/pda/botanist
name = "botanist PDA"
greyscale_config = /datum/greyscale_config/tablet/stripe_thick
@@ -45,6 +45,8 @@
var/is_silicon = FALSE
/// Whether or not we're in a mime PDA.
var/mime_mode = FALSE
/// Whether this app can send messages to all.
var/spam_mode = FALSE
/datum/computer_file/program/messenger/proc/ScrubMessengerList()
var/list/dictionary = list()
@@ -185,11 +187,7 @@
data["sortByJob"] = sort_by_job
data["isSilicon"] = is_silicon
data["photo"] = photo_path
var/obj/item/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
if(card_slot)
var/obj/item/card/id/id_card = card_slot ? card_slot.stored_card : ""
data["canSpam"] = (ACCESS_LAWYER in id_card?.access)
data["canSpam"] = spam_mode
var/obj/item/computer_hardware/hard_drive/portable/virus/disk = computer.all_components[MC_SDD]
if(disk)
@@ -11,7 +11,7 @@
tgui_id = "NtosNetMonitor"
program_icon = "network-wired"
/datum/computer_file/program/ntnetmonitor/ui_act(action, params)
/datum/computer_file/program/ntnetmonitor/ui_act(action, list/params, datum/tgui/ui)
. = ..()
if(.)
return
@@ -49,6 +49,20 @@
return
SSnetworks.station_network.toggle_function(text2num(params["id"]))
return TRUE
if("toggle_mass_pda")
if(!SSnetworks.station_network)
return
var/mob/user = ui.user
var/obj/item/modular_computer/target_tablet = locate(params["ref"]) in GLOB.TabletMessengers
if(!istype(target_tablet))
return
var/obj/item/computer_hardware/hard_drive/drive = target_tablet.all_components[MC_HDD]
if(!drive)
to_chat(user, span_boldnotice("Target tablet somehow is lacking a hard drive."))
return
for(var/datum/computer_file/program/messenger/messenger_app in drive.stored_files)
messenger_app.spam_mode = !messenger_app.spam_mode
/datum/computer_file/program/ntnetmonitor/ui_data(mob/user)
if(!SSnetworks.station_network)
@@ -73,4 +87,19 @@
data["ntnetlogs"] += list(list("entry" = i))
data["ntnetmaxlogs"] = SSnetworks.setting_maxlogcount
data["tablets"] = list()
for(var/obj/item/modular_computer/messenger in GetViewableDevices())
var/list/tablet_data = list()
if(messenger.saved_identification)
var/obj/item/computer_hardware/hard_drive/drive = messenger.all_components[MC_HDD]
if(!drive)
continue
for(var/datum/computer_file/program/messenger/messenger_app in drive.stored_files)
tablet_data["enabled_spam"] += messenger_app.spam_mode
tablet_data["name"] += messenger.saved_identification
tablet_data["ref"] += REF(messenger)
data["tablets"] += list(tablet_data)
return data
+1 -1
View File
@@ -3613,7 +3613,6 @@
#include "code\modules\modular_computers\file_system\programs\notepad.dm"
#include "code\modules\modular_computers\file_system\programs\ntdownloader.dm"
#include "code\modules\modular_computers\file_system\programs\ntmessenger.dm"
#include "code\modules\modular_computers\file_system\programs\ntmonitor.dm"
#include "code\modules\modular_computers\file_system\programs\ntnrc_client.dm"
#include "code\modules\modular_computers\file_system\programs\phys_scanner.dm"
#include "code\modules\modular_computers\file_system\programs\portrait_printer.dm"
@@ -3628,6 +3627,7 @@
#include "code\modules\modular_computers\file_system\programs\sm_monitor.dm"
#include "code\modules\modular_computers\file_system\programs\statusdisplay.dm"
#include "code\modules\modular_computers\file_system\programs\techweb.dm"
#include "code\modules\modular_computers\file_system\programs\wirecarp.dm"
#include "code\modules\modular_computers\file_system\programs\antagonist\dos.dm"
#include "code\modules\modular_computers\file_system\programs\antagonist\revelation.dm"
#include "code\modules\modular_computers\hardware\_hardware.dm"
+230 -122
View File
@@ -1,9 +1,10 @@
import { useBackend } from '../backend';
import { Box, Button, LabeledList, NoticeBox, NumberInput, Section } from '../components';
import { useBackend, useSharedState } from '../backend';
import { Box, Button, LabeledList, NoticeBox, NumberInput, Icon, Section, Stack, Tabs } from '../components';
import { NtosWindow } from '../layouts';
export const NtosNetMonitor = (props, context) => {
const { act, data } = useBackend(context);
const [tab_main, setTab_main] = useSharedState(context, 'tab_main', 1);
const {
ntnetrelays,
ntnetstatus,
@@ -17,131 +18,238 @@ export const NtosNetMonitor = (props, context) => {
maxlogs,
minlogs,
ntnetlogs = [],
tablets = [],
} = data;
return (
<NtosWindow>
<NtosWindow.Content scrollable>
<NoticeBox>
WARNING: Disabling wireless transmitters when using
a wireless device may prevent you from reenabling them!
</NoticeBox>
<Section
title="Wireless Connectivity"
buttons={(
<Button.Confirm
icon={ntnetstatus ? 'power-off' : 'times'}
content={ntnetstatus ? 'ENABLED' : 'DISABLED'}
selected={ntnetstatus}
onClick={() => act('toggleWireless')} />
)}>
{ntnetrelays ? (
<LabeledList>
<LabeledList.Item label="Active NTNet Relays">
{ntnetrelays}
</LabeledList.Item>
</LabeledList>
) : "No Relays Connected"}
</Section>
<Section title="Firewall Configuration">
<LabeledList>
<LabeledList.Item
label="Software Downloads"
buttons={(
<Button
icon={config_softwaredownload ? 'power-off' : 'times'}
content={config_softwaredownload ? 'ENABLED' : 'DISABLED'}
selected={config_softwaredownload}
onClick={() => act('toggle_function', { id: "1" })} />
)} />
<LabeledList.Item
label="Peer to Peer Traffic"
buttons={(
<Button
icon={config_peertopeer ? 'power-off' : 'times'}
content={config_peertopeer ? 'ENABLED' : 'DISABLED'}
selected={config_peertopeer}
onClick={() => act('toggle_function', { id: "2" })} />
)} />
<LabeledList.Item
label="Communication Systems"
buttons={(
<Button
icon={config_communication ? 'power-off' : 'times'}
content={config_communication ? 'ENABLED' : 'DISABLED'}
selected={config_communication}
onClick={() => act('toggle_function', { id: "3" })} />
)} />
<LabeledList.Item
label="Remote System Control"
buttons={(
<Button
icon={config_systemcontrol ? 'power-off' : 'times'}
content={config_systemcontrol ? 'ENABLED' : 'DISABLED'}
selected={config_systemcontrol}
onClick={() => act('toggle_function', { id: "4" })} />
)} />
</LabeledList>
</Section>
<Section title="Security Systems">
{!!idsalarm && (
<>
<NoticeBox>
NETWORK INCURSION DETECTED
</NoticeBox>
<Box italics>
Abnormal activity has been detected in the network.
Check system logs for more information
</Box>
</>
)}
<LabeledList>
<LabeledList.Item
label="IDS Status"
buttons={(
<>
<Button
icon={idsstatus ? 'power-off' : 'times'}
content={idsstatus ? 'ENABLED' : 'DISABLED'}
selected={idsstatus}
onClick={() => act('toggleIDS')} />
<Button
icon="sync"
content="Reset"
color="bad"
onClick={() => act('resetIDS')} />
</>
)} />
<LabeledList.Item
label="Max Log Count"
buttons={(
<NumberInput
value={ntnetmaxlogs}
minValue={minlogs}
maxValue={maxlogs}
width="39px"
onChange={(e, value) => act('updatemaxlogs', {
new_number: value,
})}
/>
)} />
</LabeledList>
<Section
title="System Log"
level={2}
buttons={(
<Button.Confirm
icon="trash"
content="Clear Logs"
onClick={() => act('purgelogs')} />
)}>
{ntnetlogs.map(log => (
<Box key={log.entry} className="candystripe">
{log.entry}
</Box>
))}
</Section>
</Section>
<Stack.Item>
<Tabs>
<Tabs.Tab
icon="network-wired"
lineHeight="23px"
selected={tab_main === 1}
onClick={() => setTab_main(1)}>
NtNet
</Tabs.Tab>
<Tabs.Tab
icon="tablet"
lineHeight="23px"
selected={tab_main === 2}
onClick={() => setTab_main(2)}>
Tablets ({tablets.length})
</Tabs.Tab>
</Tabs>
</Stack.Item>
{tab_main === 1 && (
<Stack.Item>
<MainPage
ntnetrelays={ntnetrelays}
ntnetstatus={ntnetstatus}
config_softwaredownload={config_softwaredownload}
config_peertopeer={config_peertopeer}
config_communication={config_communication}
config_systemcontrol={config_systemcontrol}
idsalarm={idsalarm}
idsstatus={idsstatus}
ntnetmaxlogs={ntnetmaxlogs}
maxlogs={maxlogs}
minlogs={minlogs}
ntnetlogs={ntnetlogs} />
</Stack.Item>
)}
{tab_main === 2 && (
<Stack.Item>
<TabletPage
tablets={tablets} />
</Stack.Item>
)}
</NtosWindow.Content>
</NtosWindow>
);
};
const MainPage = (props, context) => {
const {
ntnetrelays,
ntnetstatus,
config_softwaredownload,
config_peertopeer,
config_communication,
config_systemcontrol,
idsalarm,
idsstatus,
ntnetmaxlogs,
maxlogs,
minlogs,
ntnetlogs = [],
} = props;
const { act, data } = useBackend(context);
return (
<Section>
<NoticeBox>
WARNING: Disabling wireless transmitters when using
a wireless device may prevent you from reenabling them!
</NoticeBox>
<Section
title="Wireless Connectivity"
buttons={(
<Button.Confirm
icon={ntnetstatus ? 'power-off' : 'times'}
content={ntnetstatus ? 'ENABLED' : 'DISABLED'}
selected={ntnetstatus}
onClick={() => act('toggleWireless')} />
)}>
{ntnetrelays ? (
<LabeledList>
<LabeledList.Item label="Active NTNet Relays">
{ntnetrelays}
</LabeledList.Item>
</LabeledList>
) : "No Relays Connected"}
</Section>
<Section title="Firewall Configuration">
<LabeledList>
<LabeledList.Item
label="Software Downloads"
buttons={(
<Button
icon={config_softwaredownload ? 'power-off' : 'times'}
content={config_softwaredownload ? 'ENABLED' : 'DISABLED'}
selected={config_softwaredownload}
onClick={() => act('toggle_function', { id: "1" })} />
)} />
<LabeledList.Item
label="Peer to Peer Traffic"
buttons={(
<Button
icon={config_peertopeer ? 'power-off' : 'times'}
content={config_peertopeer ? 'ENABLED' : 'DISABLED'}
selected={config_peertopeer}
onClick={() => act('toggle_function', { id: "2" })} />
)} />
<LabeledList.Item
label="Communication Systems"
buttons={(
<Button
icon={config_communication ? 'power-off' : 'times'}
content={config_communication ? 'ENABLED' : 'DISABLED'}
selected={config_communication}
onClick={() => act('toggle_function', { id: "3" })} />
)} />
<LabeledList.Item
label="Remote System Control"
buttons={(
<Button
icon={config_systemcontrol ? 'power-off' : 'times'}
content={config_systemcontrol ? 'ENABLED' : 'DISABLED'}
selected={config_systemcontrol}
onClick={() => act('toggle_function', { id: "4" })} />
)} />
</LabeledList>
</Section>
<Section title="Security Systems">
{!!idsalarm && (
<>
<NoticeBox>
NETWORK INCURSION DETECTED
</NoticeBox>
<Box italics>
Abnormal activity has been detected in the network.
Check system logs for more information
</Box>
</>
)}
<LabeledList>
<LabeledList.Item
label="IDS Status"
buttons={(
<>
<Button
icon={idsstatus ? 'power-off' : 'times'}
content={idsstatus ? 'ENABLED' : 'DISABLED'}
selected={idsstatus}
onClick={() => act('toggleIDS')} />
<Button
icon="sync"
content="Reset"
color="bad"
onClick={() => act('resetIDS')} />
</>
)} />
<LabeledList.Item
label="Max Log Count"
buttons={(
<NumberInput
value={ntnetmaxlogs}
minValue={minlogs}
maxValue={maxlogs}
width="39px"
onChange={(e, value) => act('updatemaxlogs', {
new_number: value,
})}
/>
)} />
</LabeledList>
<Section
title="System Log"
level={2}
buttons={(
<Button.Confirm
icon="trash"
content="Clear Logs"
onClick={() => act('purgelogs')} />
)}>
{ntnetlogs.map(log => (
<Box key={log.entry} className="candystripe">
{log.entry}
</Box>
))}
</Section>
</Section>
</Section>
);
};
const TabletPage = (props, context) => {
const { tablets } = props;
const { act, data } = useBackend(context);
if (!tablets.length) {
return (
<NoticeBox>
No tablets detected.
</NoticeBox>
);
}
return (
<Section>
<Stack vertical mt={1}>
<Section fill textAlign="center">
<Icon name="comment" mr={1} />
Active Tablets
</Section>
</Stack>
<Stack vertical mt={1}>
<Section fill>
<Stack vertical>
{tablets.map(tablet => (
<Section
key={tablet.ref}
title={tablet.name}
buttons={(
<Button.Confirm
icon={tablet.enabled_spam ? 'unlock' : 'lock'}
color={tablet.enabled_spam ? 'good' : 'default'}
content={tablet.enabled_spam ? "Restrict Mass PDA" : "Allow Mass PDA"}
onClick={() => act('toggle_mass_pda', {
ref: tablet.ref,
})}
/>
)} />
))}
</Stack>
</Section>
</Stack>
</Section>
);
};