[MIRROR] NT Software Hub shows programs you do not have permissions to download (#1115)

* NT Software Hub shows programs you do not have permissions to download (#54075)

* Show disabled downloads so you know what exists

* sorted list of apps

* NT Software Hub shows programs you do not have permissions to download

Co-authored-by: NightRed <nightred@gmail.com>
This commit is contained in:
SkyratBot
2020-10-02 14:58:52 +02:00
committed by GitHub
parent 595fad67ca
commit 415bc0f736
3 changed files with 28 additions and 8 deletions

View File

@@ -149,7 +149,7 @@
for(var/A in main_repo)
var/datum/computer_file/program/P = A
// Only those programs our user can run will show in the list
if(!P.can_run(user,transfer = 1, access = access) || hard_drive.find_file_by_name(P.filename))
if(hard_drive.find_file_by_name(P.filename))
continue
all_entries.Add(list(list(
"filename" = P.filename,
@@ -157,6 +157,7 @@
"fileinfo" = P.extended_desc,
"compatibility" = check_compatibility(P),
"size" = P.size,
"access" = P.can_run(user,transfer = 1, access = access)
)))
data["hackedavailable"] = FALSE
if(emagged) // If we are running on emagged computer we have access to some "bonus" software
@@ -170,7 +171,9 @@
"filename" = P.filename,
"filedesc" = P.filedesc,
"fileinfo" = P.extended_desc,
"compatibility" = check_compatibility(P),
"size" = P.size,
"access" = TRUE,
)))
data["hacked_programs"] = hacked_programs

View File

@@ -43,7 +43,16 @@ export const NtosNetDownloader = (props, context) => {
</LabeledList>
</Section>
<Section>
{downloadable_programs.map(program => (
{downloadable_programs
.filter(program => program.access)
.map(program => (
<Program
key={program.filename}
program={program} />
))}
{downloadable_programs
.filter(program => !program.access)
.map(program => (
<Program
key={program.filename}
program={program} />
@@ -100,7 +109,9 @@ const Program = (props, context) => {
fluid
icon="download"
content="Download"
disabled={downloading || program.size > disk_free}
disabled={
downloading || program.size > disk_free || !program.access
}
onClick={() => act('PRG_downloadfile', {
filename: program.filename,
})} />
@@ -113,6 +124,12 @@ const Program = (props, context) => {
Incompatible!
</Box>
)}
{!(program.access) && (
<Box mt={1} italic fontSize="12px" position="relative">
<Icon mx={1} color="red" name="times" />
Invalid credentials loaded!
</Box>
)}
{program.size > disk_free && (
<Box mt={1} italic fontSize="12px" position="relative">
<Icon mx={1} color="red" name="times" />

File diff suppressed because one or more lines are too long