diff --git a/actions/azurestorage.js b/actions/azurestorage.js
index 2ecad913..68206580 100644
--- a/actions/azurestorage.js
+++ b/actions/azurestorage.js
@@ -1715,33 +1715,6 @@ function formatDateDisplay(date) {
: "Unknown";
}
-function formatBlobDates(blob) {
- const created = blob.createdOn ? new Date(blob.createdOn) : null;
- const modified = blob.lastModified ? new Date(blob.lastModified) : null;
-
- if (!created && !modified) return "Unknown";
-
- // If both exist and are the same
- if (created && modified && created.getTime() === modified.getTime()) {
- return `${created.toLocaleString("en-GB")} (${formatTimeSince(
- created
- )})`;
- }
-
- // If modified exists and is newer than created
- if (created && modified && modified.getTime() > created.getTime()) {
- return `Created: ${created.toLocaleString("en-GB")} (${formatTimeSince(
- created
- )}), Modified: ${modified.toLocaleString("en-GB")} (${formatTimeSince(
- modified
- )})`;
- }
-
- // Only one date exists
- const date = modified || created;
- return `${date.toLocaleString("en-GB")} (${formatTimeSince(date)})`;
-}
-
export async function listBlobHierarchicalForUser(containerClient) {
const blobNames = [];
for await (const blob of containerClient.listBlobsFlat()) {
diff --git a/pages/auth/signin2.js b/pages/auth/signin2.js
index 0e14448a..569281e7 100644
--- a/pages/auth/signin2.js
+++ b/pages/auth/signin2.js
@@ -207,6 +207,35 @@ const SignIn = (props) => {
};
export async function getServerSideProps(context) {
+ const { query, req, res } = context;
+
+ // Load allowed IPs from env and trim spaces
+ const ALLOWED_IPS = process.env.ALLOWED_IPS
+ ? process.env.ALLOWED_IPS.split(",").map((ip) => ip.trim())
+ : [];
+
+ // Always allow localhost addresses
+ const LOCALHOST_IPS = ["127.0.0.1", "::1"];
+
+ // Get IP address from headers or socket
+ const forwarded = req.headers["x-forwarded-for"];
+ const ip =
+ typeof forwarded === "string"
+ ? forwarded.split(",")[0]
+ : req.socket.remoteAddress;
+
+ console.log("Visitor IP:", ip);
+
+ // Check whitelist + localhost
+ if (![...ALLOWED_IPS, ...LOCALHOST_IPS].includes(ip)) {
+ return {
+ redirect: {
+ destination: "/403", // custom "Access Denied" page
+ permanent: false,
+ },
+ };
+ }
+
if (process.env.SHOWLOGIN == false) {
return {
redirect: {
diff --git a/pages/storageAdmin.js b/pages/storageAdmin.js
index c65167d9..805cbdc3 100644
--- a/pages/storageAdmin.js
+++ b/pages/storageAdmin.js
@@ -110,11 +110,11 @@ const deleteCaseItem = (containerID, caseID) => {
});
};
-export default function StoragePage({ data }) {
- console.log(data);
-
+export default function StoragePage(props) {
+ const { data, userData } = props;
const [showRepJson, setShowRepJson] = useState(true);
const [showTmpFile, setShowTmpFile] = useState(true);
+ const [whichTab, setWhichTab] = useState("storage");
const toggleAll = () => {
const newState = !(showRepJson || showTmpFile);
@@ -130,283 +130,394 @@ export default function StoragePage({ data }) {
rep.json file found:{" "} {folder.repJsonBlob.name}
)} */} - {folder.hasTmpFile && ( - <> - - > - )} - {folder.hasRepJson && ( -