diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index aa7dbe3..42fe619 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/README.md b/README.md
index e4a487d..f96f20b 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,8 @@
+# Currently in Development
+This project is currently in development, and not ready for deployment yet.
+
+---
+
// LOGO OR BANNER GOES HERE
## What is this?
diff --git a/cypress/e2e/api.cy.ts b/cypress/e2e/api.cy.ts
new file mode 100644
index 0000000..65afa9b
--- /dev/null
+++ b/cypress/e2e/api.cy.ts
@@ -0,0 +1,569 @@
+const hash = require("../../src/utils/hashHelper");
+
+const ids: { [key: string]: string } = {
+ file: "1K_KyC8B54En7UaD3_o7zubxwG4jtXTVK",
+ folder: "12fKI0g0Uvkubk1sSHCd_SDErLyc9TlWe",
+ protectedFolder: "1p6znx1BKPsqFnyOPw49uhoc8FNglfYnD",
+ protectedFile: "1NK-J1QIf0vuGnDIEHXBG2-9jXP6sKCuN",
+ protectedSubFolder: "1_N87OSlhPYfC3L1fGfE546LoJnCK8zBX",
+ protectedSubFile: "1CSKTtgXunrSHYRRp8FyMXYpNP6xK1iju",
+ protectedInsideProtected: "1VMU0sQOkuI06icRRJFof-6V-NLyBWlp5",
+ protectedFileInsideProtected: "1wXsNhp8JxOc8iBRyb98PkR1G_MijE2e0",
+};
+
+describe("Files API", () => {
+ it("Get root files", () => {
+ cy.request({
+ method: "GET",
+ url: "/api/files",
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(false);
+ expect(response.body.passwordValidated).to.satisfy(
+ (key: any) => key === true || key === undefined,
+ );
+ expect(response.body.protectedId).to.eq(undefined);
+ expect(response.body.folders).to.have.length.at.least(0);
+ expect(response.body.files).to.have.length.at.least(0);
+ expect(response.body.readmeExists).to.be.a("boolean");
+ expect(response.body.nextPageToken).to.satisfy(
+ (key: any) => typeof key === "string" || key === undefined,
+ );
+ });
+ });
+
+ it("Get file", () => {
+ cy.request({
+ method: "GET",
+ url: `/api/files/${ids.file}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(false);
+ expect(response.body.passwordValidated).to.satisfy(
+ (key: any) => key === true || key === undefined,
+ );
+ expect(response.body.protectedId).to.eq(undefined);
+ expect(response.body.parents).to.have.length.at.least(0);
+ expect(response.body.file).to.have.property("id");
+ });
+ });
+
+ it("Get folder", () => {
+ cy.request({
+ method: "GET",
+ url: `/api/files/${ids.folder}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(false);
+ expect(response.body.passwordValidated).to.satisfy(
+ (key: any) => key === true || key === undefined,
+ );
+ expect(response.body.protectedId).to.eq(undefined);
+ expect(response.body.parents).to.have.length.at.least(0);
+ expect(response.body.folders).to.have.length.at.least(0);
+ expect(response.body.files).to.have.length.at.least(0);
+ expect(response.body.readmeExists).to.be.a("boolean");
+ expect(response.body.nextPageToken).to.satisfy(
+ (key: any) => typeof key === "string" || key === undefined,
+ );
+ });
+ });
+
+ it("View file", () => {
+ // Test if file returning a binary
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${ids.file}/view`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.headers).have.property("content-type");
+ expect(response.headers)
+ .have.property("content-disposition")
+ .contains("inline");
+ });
+ });
+
+ it("Download file", () => {
+ // Test if file returning a binary
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${ids.file}/download`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.headers).have.property("content-type");
+ expect(response.headers)
+ .have.property("content-disposition")
+ .contains("attachment");
+ });
+ });
+});
+
+describe("Protected files API", () => {
+ const folder = ids.protectedFolder;
+ const file = ids.protectedFile;
+ it("Get protected folder - without password", () => {
+ cy.request({
+ method: "GET",
+ url: `/api/files/${folder}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ expect(response.body.protectedId).to.be.a("string");
+ });
+ });
+ it("Get protected folder - wrong password", () => {
+ const hashPassword = hash.hashToken("wrong password");
+ cy.request({
+ method: "GET",
+ url: `/api/files/${folder}`,
+ headers: {
+ Authorization: `Bearer ${hashPassword}`,
+ },
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ expect(response.body.protectedId).to.be.a("string");
+ });
+ });
+ it("Get protected folder - with password", () => {
+ const hashPassword = hash.hashToken("loremipsum");
+ cy.request({
+ method: "GET",
+ url: `/api/files/${folder}`,
+ headers: {
+ Authorization: `Bearer ${hashPassword}`,
+ },
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(true);
+ expect(response.body.protectedId).to.be.a("string");
+ expect(response.body.parents).to.have.length.at.least(0);
+ expect(response.body.folders).to.have.length.at.least(0);
+ expect(response.body.files).to.have.length.at.least(0);
+ expect(response.body.readmeExists).to.be.a("boolean");
+ expect(response.body.nextPageToken).to.satisfy(
+ (key: any) => typeof key === "string" || key === undefined,
+ );
+ });
+ });
+
+ it("Get protected file - without password", () => {
+ cy.request({
+ method: "GET",
+ url: `/api/files/${file}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ expect(response.body.protectedId).to.be.a("string");
+ });
+ });
+ it("Get protected file - wrong password", () => {
+ const hashPassword = hash.hashToken("wrong password");
+ cy.request({
+ method: "GET",
+ url: `/api/files/${file}`,
+ headers: {
+ Authorization: `Bearer ${hashPassword}`,
+ },
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ expect(response.body.protectedId).to.be.a("string");
+ });
+ });
+ it("Get protected file - with password", () => {
+ const hashPassword = hash.hashToken("loremipsum");
+ // The file is in a protected folder, so the password is the same
+ cy.request({
+ method: "GET",
+ url: `/api/files/${file}`,
+ headers: {
+ Authorization: `Bearer ${hashPassword}`,
+ },
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(true);
+ expect(response.body.protectedId).to.be.a("string");
+ expect(response.body.parents).to.have.length.at.least(0);
+ expect(response.body.file).to.have.property("id");
+ });
+ });
+
+ it("View protected file - without token", () => {
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${file}/view`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ });
+ });
+ it("View protected file - with wrong token", () => {
+ const hashPassword = hash.hashToken("wrongpassword");
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${file}/view?hash=${hashPassword}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ });
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${file}/download?hash=${hashPassword}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ });
+ });
+ it("View protected file - with token", () => {
+ const hashPassword = hash.hashToken("loremipsum");
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${file}/view?token=${hashPassword}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.headers).have.property("content-type");
+ // expect(response.headers)
+ // .have.property("content-disposition")
+ // .contains("inline");
+ });
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${file}/download?token=${hashPassword}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.headers).have.property("content-type");
+ // expect(response.headers)
+ // .have.property("content-disposition")
+ // .contains("attachment");
+ });
+ });
+});
+
+describe("Protected files sub folder API", () => {
+ const folder = ids.protectedSubFolder;
+ const file = ids.protectedSubFile;
+ it("Get protected folder - without password", () => {
+ cy.request({
+ method: "GET",
+ url: `/api/files/${folder}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ expect(response.body.protectedId).to.be.a("string");
+ });
+ });
+ it("Get protected folder - wrong password", () => {
+ const hashPassword = hash.hashToken("wrong password");
+ cy.request({
+ method: "GET",
+ url: `/api/files/${folder}`,
+ headers: {
+ Authorization: `Bearer ${hashPassword}`,
+ },
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ expect(response.body.protectedId).to.be.a("string");
+ });
+ });
+ it("Get protected folder - with password", () => {
+ const hashPassword = hash.hashToken("loremipsum");
+ cy.request({
+ method: "GET",
+ url: `/api/files/${folder}`,
+ headers: {
+ Authorization: `Bearer ${hashPassword}`,
+ },
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(true);
+ expect(response.body.protectedId).to.be.a("string");
+ expect(response.body.parents).to.have.length.at.least(0);
+ expect(response.body.folders).to.have.length.at.least(0);
+ expect(response.body.files).to.have.length.at.least(0);
+ expect(response.body.readmeExists).to.be.a("boolean");
+ expect(response.body.nextPageToken).to.satisfy(
+ (key: any) => typeof key === "string" || key === undefined,
+ );
+ });
+ });
+
+ it("Get protected file - without password", () => {
+ cy.request({
+ method: "GET",
+ url: `/api/files/${file}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ expect(response.body.protectedId).to.be.a("string");
+ });
+ });
+ it("Get protected file - wrong password", () => {
+ const hashPassword = hash.hashToken("wrong password");
+ cy.request({
+ method: "GET",
+ url: `/api/files/${file}`,
+ headers: {
+ Authorization: `Bearer ${hashPassword}`,
+ },
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ expect(response.body.protectedId).to.be.a("string");
+ });
+ });
+ it("Get protected file - with password", () => {
+ const hashPassword = hash.hashToken("loremipsum");
+ // The file is in a protected folder, so the password is the same
+ cy.request({
+ method: "GET",
+ url: `/api/files/${file}`,
+ headers: {
+ Authorization: `Bearer ${hashPassword}`,
+ },
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(true);
+ expect(response.body.protectedId).to.be.a("string");
+ expect(response.body.parents).to.have.length.at.least(0);
+ expect(response.body.file).to.have.property("id");
+ });
+ });
+
+ it("View protected file - without token", () => {
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${file}/view`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ });
+ });
+ it("View protected file - with wrong token", () => {
+ const hashPassword = hash.hashToken("wrongpassword");
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${file}/view?hash=${hashPassword}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ });
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${file}/download?hash=${hashPassword}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ });
+ });
+ it("View protected file - with token", () => {
+ const hashPassword = hash.hashToken("loremipsum");
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${file}/view?token=${hashPassword}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.headers).have.property("content-type");
+ // expect(response.headers)
+ // .have.property("content-disposition")
+ // .contains("inline");
+ });
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${file}/download?token=${hashPassword}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.headers).have.property("content-type");
+ // expect(response.headers)
+ // .have.property("content-disposition")
+ // .contains("attachment");
+ });
+ });
+});
+
+describe("Protected files inside protected API", () => {
+ const folder = ids.protectedInsideProtected;
+ const file = ids.protectedFileInsideProtected;
+ it("Get protected folder - without password", () => {
+ cy.request({
+ method: "GET",
+ url: `/api/files/${folder}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ expect(response.body.protectedId).to.be.a("string");
+ });
+ });
+ it("Get protected folder - wrong password", () => {
+ const hashPassword = hash.hashToken("wrong password");
+ cy.request({
+ method: "GET",
+ url: `/api/files/${folder}`,
+ headers: {
+ Authorization: `Bearer ${hashPassword}`,
+ },
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ expect(response.body.protectedId).to.be.a("string");
+ });
+ });
+ it("Get protected folder - with password", () => {
+ const hashPassword = hash.hashToken("123");
+ cy.request({
+ method: "GET",
+ url: `/api/files/${folder}`,
+ headers: {
+ Authorization: `Bearer ${hashPassword}`,
+ },
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(true);
+ expect(response.body.protectedId).to.be.a("string");
+ expect(response.body.parents).to.have.length.at.least(0);
+ expect(response.body.folders).to.have.length.at.least(0);
+ expect(response.body.files).to.have.length.at.least(0);
+ expect(response.body.readmeExists).to.be.a("boolean");
+ expect(response.body.nextPageToken).to.satisfy(
+ (key: any) => typeof key === "string" || key === undefined,
+ );
+ });
+ });
+
+ it("Get protected file - without password", () => {
+ cy.request({
+ method: "GET",
+ url: `/api/files/${file}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ expect(response.body.protectedId).to.be.a("string");
+ });
+ });
+ it("Get protected file - wrong password", () => {
+ const hashPassword = hash.hashToken("wrong password");
+ cy.request({
+ method: "GET",
+ url: `/api/files/${file}`,
+ headers: {
+ Authorization: `Bearer ${hashPassword}`,
+ },
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ expect(response.body.protectedId).to.be.a("string");
+ });
+ });
+ it("Get protected file - with password", () => {
+ const hashPassword = hash.hashToken("123");
+ // The file is in a protected folder, so the password is the same
+ cy.request({
+ method: "GET",
+ url: `/api/files/${file}`,
+ headers: {
+ Authorization: `Bearer ${hashPassword}`,
+ },
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(true);
+ expect(response.body.protectedId).to.be.a("string");
+ expect(response.body.parents).to.have.length.at.least(0);
+ expect(response.body.file).to.have.property("id");
+ });
+ });
+
+ it("View protected file - without token", () => {
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${file}/view`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ });
+ });
+ it("View protected file - with wrong token", () => {
+ const hashPassword = hash.hashToken("wrongpassword");
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${file}/view?hash=${hashPassword}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ });
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${file}/download?hash=${hashPassword}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body.passwordRequired).to.eq(true);
+ expect(response.body.passwordValidated).to.eq(false);
+ });
+ });
+ it("View protected file - with token", () => {
+ const hashPassword = hash.hashToken("123");
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${file}/view?token=${hashPassword}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.headers).have.property("content-type");
+ // expect(response.headers)
+ // .have.property("content-disposition")
+ // .contains("inline");
+ });
+ cy.request({
+ method: "GET",
+ encoding: "binary",
+ url: `/api/files/${file}/download?token=${hashPassword}`,
+ }).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.headers).have.property("content-type");
+ // expect(response.headers)
+ // .have.property("content-disposition")
+ // .contains("attachment");
+ });
+ });
+});
diff --git a/cypress/e2e/files.cy.ts b/cypress/e2e/files.cy.ts
deleted file mode 100644
index 9c5deaa..0000000
--- a/cypress/e2e/files.cy.ts
+++ /dev/null
@@ -1,120 +0,0 @@
-const hash = require("../../src/utils/hashHelper");
-
-const ids: { [key: string]: string } = {
- file: "1K_KyC8B54En7UaD3_o7zubxwG4jtXTVK",
- folder: "12fKI0g0Uvkubk1sSHCd_SDErLyc9TlWe",
- protectedFolder: "1p6znx1BKPsqFnyOPw49uhoc8FNglfYnD",
- protectedFile: "1NK-J1QIf0vuGnDIEHXBG2-9jXP6sKCuN",
- protectedSubFolder: "1_N87OSlhPYfC3L1fGfE546LoJnCK8zBX",
- protectedSubFile: "1CSKTtgXunrSHYRRp8FyMXYpNP6xK1iju",
- protectedInsideProtected: "1VMU0sQOkuI06icRRJFof-6V-NLyBWlp5",
- protectedFileInsideProtected: "1wXsNhp8JxOc8iBRyb98PkR1G_MijE2e0",
-};
-
-describe("Files API", () => {
- it("Get root files", () => {
- cy.request({
- method: "GET",
- url: "/api/files",
- }).then((response) => {
- expect(response.status).to.eq(200);
- expect(response.body.passwordRequired).to.eq(false);
- expect(response.body.passwordValidated).to.satisfy(
- (key: any) => key === true || key === undefined,
- );
- expect(response.body.protectedId).to.eq(undefined);
- expect(response.body.folders).to.have.length.at.least(0);
- expect(response.body.files).to.have.length.at.least(0);
- expect(response.body.readmeExists).to.be.a("boolean");
- expect(response.body.nextPageToken).to.satisfy(
- (key: any) => typeof key === "string" || key === undefined,
- );
- });
- });
-
- it("Get file", () => {
- cy.request({
- method: "GET",
- url: `/api/files/${ids.file}`,
- }).then((response) => {
- expect(response.status).to.eq(200);
- expect(response.body.passwordRequired).to.eq(false);
- expect(response.body.passwordValidated).to.satisfy(
- (key: any) => key === true || key === undefined,
- );
- expect(response.body.protectedId).to.eq(undefined);
- expect(response.body.parents).to.have.length.at.least(0);
- expect(response.body.file).to.have.property("id");
- });
- });
-
- it("Get folder", () => {
- cy.request({
- method: "GET",
- url: `/api/files/${ids.folder}`,
- }).then((response) => {
- expect(response.status).to.eq(200);
- expect(response.body.passwordRequired).to.eq(false);
- expect(response.body.passwordValidated).to.satisfy(
- (key: any) => key === true || key === undefined,
- );
- expect(response.body.protectedId).to.eq(undefined);
- expect(response.body.parents).to.have.length.at.least(0);
- expect(response.body.folders).to.have.length.at.least(0);
- expect(response.body.files).to.have.length.at.least(0);
- expect(response.body.readmeExists).to.be.a("boolean");
- expect(response.body.nextPageToken).to.satisfy(
- (key: any) => typeof key === "string" || key === undefined,
- );
- });
- });
-
- it("Get protected folder - without password", () => {
- cy.request({
- method: "GET",
- url: `/api/files/${ids.protectedFolder}`,
- }).then((response) => {
- expect(response.status).to.eq(200);
- expect(response.body.passwordRequired).to.eq(true);
- expect(response.body.passwordValidated).to.eq(false);
- expect(response.body.protectedId).to.be.a("string");
- });
- });
- it("Get protected folder - wrong password", () => {
- const hashPassword = hash.hashToken("wrong password");
- cy.request({
- method: "GET",
- url: `/api/files/${ids.protectedFolder}`,
- headers: {
- Authorization: `Bearer ${hashPassword}`,
- },
- }).then((response) => {
- expect(response.status).to.eq(200);
- expect(response.body.passwordRequired).to.eq(true);
- expect(response.body.passwordValidated).to.eq(false);
- expect(response.body.protectedId).to.be.a("string");
- });
- });
- it("Get protected folder - with password", () => {
- const hashPassword = hash.hashToken("loremipsum");
- cy.request({
- method: "GET",
- url: `/api/files/${ids.protectedFolder}`,
- headers: {
- Authorization: `Bearer ${hashPassword}`,
- },
- }).then((response) => {
- expect(response.status).to.eq(200);
- expect(response.body.passwordRequired).to.eq(true);
- expect(response.body.passwordValidated).to.eq(true);
- expect(response.body.protectedId).to.be.a("string");
- expect(response.body.parents).to.have.length.at.least(0);
- expect(response.body.folders).to.have.length.at.least(0);
- expect(response.body.files).to.have.length.at.least(0);
- expect(response.body.readmeExists).to.be.a("boolean");
- expect(response.body.nextPageToken).to.satisfy(
- (key: any) => typeof key === "string" || key === undefined,
- );
- });
- });
-});
diff --git a/src/components/layout/Footer/index.tsx b/src/components/layout/Footer/index.tsx
index ab95846..5445c9e 100644
--- a/src/components/layout/Footer/index.tsx
+++ b/src/components/layout/Footer/index.tsx
@@ -6,7 +6,16 @@ export default function Footer() {
return (
- {currentYear} - {siteConfig.footerText} ❤️
+ {currentYear} {siteConfig.footerText} - Powered by{" "}
+
+ gudora-index
+ {" "}
+ ❤️
);
diff --git a/src/pages/api/files/[id]/download.ts b/src/pages/api/files/[id]/download.ts
index f220add..87df4dc 100644
--- a/src/pages/api/files/[id]/download.ts
+++ b/src/pages/api/files/[id]/download.ts
@@ -55,7 +55,7 @@ export default async function handler(
// Check for password file
const validatePassword = await validateProtected(
- parentsArray[0].id,
+ parentsArray,
(headerHash as string) || (hash as string),
);
if (validatePassword.isProtected && !validatePassword.valid) {
diff --git a/src/pages/api/files/[id]/view.ts b/src/pages/api/files/[id]/view.ts
index 84d5079..bce72a7 100644
--- a/src/pages/api/files/[id]/view.ts
+++ b/src/pages/api/files/[id]/view.ts
@@ -55,7 +55,7 @@ export default async function handler(
// Check for password file
const validatePassword = await validateProtected(
- parentsArray[0].id,
+ parentsArray,
(headerHash as string) || (hash as string),
);
if (validatePassword.isProtected && !validatePassword.valid) {