mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-21 03:51:49 +01:00
Bun, Inferno->React migration (#22529)
Re-creation of https://github.com/Aurorastation/Aurora.3/pull/21046 to skip merge conflict hell. Brings us modern TGUI. **ALTERNATE TITLE: TGUI HELLSCAPE PR ABANDON ALL HOPE YE WHO ENTER HERE** - [x] Migrate build tools (javascript -> typescript, bun for package management). - [x] Upgrade all TGUI dependencies and associated root files to TG-congruent versions (axios, babel, dompurify, eslint, highlight, marked, prettier, sass, source-map, stacktrace-parser, typescript). - [x] InfernoJS -> React migrations - [x] React cleanup and polish (migrate all remaining .js files to appropriate .ts or .tsx filetype, all remaining hooks, linting, error corrections, etc.) - [ ] Test all remaining TGUI interfaces
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
undeletable = TRUE
|
||||
tgui_id = "FileManager"
|
||||
var/open_file
|
||||
var/open_file_is_usb = FALSE
|
||||
var/error
|
||||
|
||||
/datum/computer_file/program/filemanager/ui_data(mob/user)
|
||||
@@ -27,7 +28,11 @@
|
||||
if(!computer || !computer.hard_drive)
|
||||
data["error"] = "I/O ERROR: Unable to access hard drive."
|
||||
else
|
||||
HDD = computer.hard_drive
|
||||
HDD = open_file_is_usb ? computer.portable_drive : computer.hard_drive
|
||||
data["file_is_usb"] = open_file_is_usb
|
||||
if(!HDD)
|
||||
data["error"] = "I/O ERROR: Unable to open file."
|
||||
return data
|
||||
file = HDD.find_file_by_name(open_file)
|
||||
script = file
|
||||
if(!istype(file))
|
||||
@@ -45,6 +50,7 @@
|
||||
else
|
||||
data["scriptdata"] = null
|
||||
data["filedata"] = null
|
||||
data["file_is_usb"] = FALSE
|
||||
data["filename"] = null
|
||||
HDD = computer.hard_drive
|
||||
RHDD = computer.portable_drive
|
||||
@@ -85,10 +91,23 @@
|
||||
return
|
||||
if(F.can_access_file(usr))
|
||||
open_file = params["PRG_openfile"]
|
||||
open_file_is_usb = FALSE
|
||||
|
||||
if("PRG_usbopenfile")
|
||||
. = TRUE
|
||||
var/obj/item/computer_hardware/hard_drive/RHDD = computer.portable_drive
|
||||
if(!RHDD)
|
||||
return
|
||||
var/datum/computer_file/F = RHDD.find_file_by_name(params["PRG_usbopenfile"])
|
||||
if(!F)
|
||||
return
|
||||
if(F.can_access_file(usr))
|
||||
open_file = params["PRG_usbopenfile"]
|
||||
open_file_is_usb = TRUE
|
||||
|
||||
if("PRG_newtextfile")
|
||||
. = TRUE
|
||||
var/newname = sanitize(input(usr, "Enter file name or leave blank to cancel:", "File rename"))
|
||||
var/newname = sanitize_filename(tgui_input_text(usr, "Enter file name or leave blank to cancel:", "File rename"))
|
||||
if(!newname)
|
||||
return TRUE
|
||||
var/obj/item/computer_hardware/hard_drive/HDD = computer.hard_drive
|
||||
@@ -97,7 +116,9 @@
|
||||
var/datum/computer_file/data/F = new/datum/computer_file/data()
|
||||
F.filename = newname
|
||||
F.filetype = "TXT"
|
||||
HDD.store_file(F)
|
||||
if(!HDD.store_file(F))
|
||||
qdel(F)
|
||||
error = "I/O ERROR: Unable to create file. The hard drive may be full, read-only, or contain a conflicting file."
|
||||
|
||||
if("PRG_deletefile")
|
||||
. = TRUE
|
||||
@@ -122,6 +143,7 @@
|
||||
if("PRG_closefile")
|
||||
. = TRUE
|
||||
open_file = null
|
||||
open_file_is_usb = FALSE
|
||||
error = null
|
||||
|
||||
if("PRG_clone")
|
||||
@@ -132,8 +154,13 @@
|
||||
var/datum/computer_file/F = HDD.find_file_by_name(params["PRG_clone"])
|
||||
if(!F || !istype(F))
|
||||
return TRUE
|
||||
if(istype(F, /datum/computer_file/program))
|
||||
error = "I/O ERROR: Executable programs cannot be cloned from File Manager."
|
||||
return TRUE
|
||||
var/datum/computer_file/C = F.clone(1)
|
||||
HDD.store_file(C)
|
||||
if(!HDD.store_file(C))
|
||||
qdel(C)
|
||||
error = "I/O ERROR: Unable to clone file. The hard drive may be full, read-only, or contain a conflicting file."
|
||||
|
||||
if("PRG_rename")
|
||||
. = TRUE
|
||||
@@ -143,7 +170,7 @@
|
||||
var/datum/computer_file/file = HDD.find_file_by_name(params["PRG_rename"])
|
||||
if(!file || !istype(file))
|
||||
return TRUE
|
||||
var/newname = sanitize(input(usr, "Enter new file name:", "File rename", file.filename))
|
||||
var/newname = sanitize_filename(tgui_input_text(usr, "Enter new file name or leave blank to cancel:", "File rename", file.filename))
|
||||
if(file && newname)
|
||||
file.filename = newname
|
||||
|
||||
@@ -163,7 +190,7 @@
|
||||
var/oldtext = html_decode(F.stored_data)
|
||||
oldtext = replacetext(oldtext, "\[editorbr\]", "\n")
|
||||
|
||||
var/newtext = sanitize(replacetext(input(usr, "Editing file [open_file]. You may use most tags used in paper formatting:", "Text Editor", oldtext) as message|null, "\n", "\[editorbr\]"), MAX_TEXTFILE_LENGTH)
|
||||
var/newtext = sanitize_filename(replacetext(tgui_input_text(usr, "Editing file [open_file]. You may use most tags used in paper formatting:", "Text Editor", oldtext), "\n", "\[editorbr\]"), MAX_TEXTFILE_LENGTH)
|
||||
if(!newtext)
|
||||
return
|
||||
|
||||
@@ -185,10 +212,10 @@
|
||||
return TRUE
|
||||
var/obj/item/computer_hardware/hard_drive/HDD = computer.hard_drive
|
||||
if(!HDD)
|
||||
return TRUE
|
||||
return FALSE
|
||||
if(!computer.nano_printer)
|
||||
error = "Missing Hardware: Your computer does not have required hardware to complete this operation."
|
||||
return TRUE
|
||||
return FALSE
|
||||
var/datum/computer_file/data/F = HDD.find_file_by_name(open_file)
|
||||
var/datum/computer_file/script/S = F
|
||||
if(!F)
|
||||
@@ -196,21 +223,21 @@
|
||||
if(istype(F))
|
||||
if(!computer.nano_printer.print_text(F.stored_data))
|
||||
error = "Hardware error: Printer was unable to print the file. It may be out of paper."
|
||||
return TRUE
|
||||
return FALSE
|
||||
else if(istype(S))
|
||||
if(!computer.nano_printer.print_text(S.code))
|
||||
error = "Hardware error: Printer was unable to print the file. It may be out of paper."
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
if("PRG_copytousb")
|
||||
. = TRUE
|
||||
var/obj/item/computer_hardware/hard_drive/HDD = computer.hard_drive
|
||||
var/obj/item/computer_hardware/hard_drive/portable/RHDD = computer.portable_drive
|
||||
if(!HDD || !RHDD)
|
||||
return TRUE
|
||||
return FALSE
|
||||
var/datum/computer_file/F = HDD.find_file_by_name(params["PRG_copytousb"])
|
||||
if(!F || !istype(F))
|
||||
return TRUE
|
||||
return FALSE
|
||||
var/is_usr_tech_support = FALSE
|
||||
if(ishuman(usr))
|
||||
var/mob/living/carbon/human/H = usr
|
||||
@@ -270,7 +297,7 @@
|
||||
return
|
||||
if(F.password)
|
||||
return
|
||||
F.password = sanitize(input(usr, "Enter an encryption key:", "Encrypt File"))
|
||||
F.password = sanitize_filename(tgui_input_text(usr, "Enter an encryption key:", "Encrypt File"))
|
||||
|
||||
if("PRG_decrypt")
|
||||
. = TRUE
|
||||
|
||||
Reference in New Issue
Block a user