- {file.attributes.is_file ? file.attributes.size + " bytes" : ""}
+ {file.attributes.is_file ? `${file.attributes.size} bytes` : ""}
- {formateDate(file.attributes.modified_at)}
+ {formatDistanceToNow(new Date(file.attributes.modified_at), {
+ addSuffix: true,
+ })}
handleClickContextMenu(e, file)}>
diff --git a/app/components/Icons/Server/index.tsx b/app/components/Icons/Server/index.tsx
new file mode 100644
index 0000000..cf51aae
--- /dev/null
+++ b/app/components/Icons/Server/index.tsx
@@ -0,0 +1,24 @@
+import React from "react";
+
+const index = () => {
+ return (
+ <>
+
+ >
+ );
+};
+
+export default index;
diff --git a/app/components/Pterodactyl/files.tsx b/app/components/Pterodactyl/files.tsx
index d660b4a..864a49c 100644
--- a/app/components/Pterodactyl/files.tsx
+++ b/app/components/Pterodactyl/files.tsx
@@ -12,7 +12,7 @@ export default function files(pterodactyl: any) {
method: "PUT",
headers: await pterodactyl.helpers.authHeader(),
body: JSON.stringify({
- root: "/",
+ root: pterodactyl.workingDirectory,
files: [
{
from: from.attributes.name,
@@ -34,7 +34,7 @@ export default function files(pterodactyl: any) {
async fetchFiles() {
try {
const response = await fetch(
- `${process.env.NEXT_PUBLIC_URL}/api/client/servers/${pterodactyl.server_id}/files/list`,
+ `${process.env.NEXT_PUBLIC_URL}/api/client/servers/${pterodactyl.server_id}/files/list?directory=${pterodactyl.workingDirectory}`,
{
method: "GET",
headers: await pterodactyl.helpers.authHeader(),
diff --git a/app/components/Pterodactyl/helpers.tsx b/app/components/Pterodactyl/helpers.tsx
index 2fbd437..116cb0f 100644
--- a/app/components/Pterodactyl/helpers.tsx
+++ b/app/components/Pterodactyl/helpers.tsx
@@ -18,5 +18,15 @@ export default function helpers(pterodactyl: any) {
async setServerID(serverID: string) {
return (pterodactyl.server_id = serverID);
},
+
+ // setter for working directory
+ async setWorkingDirectory(workingDirectory: string) {
+ return (pterodactyl.workingDirectory = workingDirectory);
+ },
+
+ // getter for working directory
+ async getWorkingDirectory() {
+ return pterodactyl.workingDirectory;
+ },
};
}
diff --git a/app/components/Pterodactyl/index.tsx b/app/components/Pterodactyl/index.tsx
index d386cca..9d835e1 100644
--- a/app/components/Pterodactyl/index.tsx
+++ b/app/components/Pterodactyl/index.tsx
@@ -6,6 +6,7 @@ class Pterodactyl {
api_key: string;
files: any;
helpers: any;
+ workingDirectory: string = "/";
constructor(server_id: string, api_key: string) {
this.server_id = server_id;