Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

changed readable format to json

daniel31x13ed91c4267b89
diff --git a/lib/api/archive.ts b/lib/api/archive.ts
index b0815644..635703e4 100644
--- a/lib/api/archive.ts
+++ b/lib/api/archive.ts
@@ -44,6 +44,8 @@ export default async function archive(
},
});
+ // Archive.org
+
if (user?.archiveAsWaybackMachine) sendToWayback(url);
if (user?.archiveAsPDF || user?.archiveAsScreenshot) {
@@ -74,13 +76,13 @@ export default async function archive(
id: linkId,
},
data: {
- readabilityPath: `archives/${targetLink.collectionId}/${linkId}_readability.txt`,
+ readabilityPath: `archives/${targetLink.collectionId}/${linkId}_readability.json`,
},
});
await createFile({
data: JSON.stringify(article),
- filePath: `archives/${targetLink.collectionId}/${linkId}_readability.txt`,
+ filePath: `archives/${targetLink.collectionId}/${linkId}_readability.json`,
});
console.log(JSON.parse(JSON.stringify(article)));
diff --git a/lib/api/controllers/links/linkId/deleteLinkById.ts b/lib/api/controllers/links/linkId/deleteLinkById.ts
index 3273a5c6..8a56656f 100644
--- a/lib/api/controllers/links/linkId/deleteLinkById.ts
+++ b/lib/api/controllers/links/linkId/deleteLinkById.ts
@@ -32,7 +32,7 @@ export default async function deleteLink(userId: number, linkId: number) {
filePath: `archives/${collectionIsAccessible?.id}/${linkId}.png`,
});
removeFile({
- filePath: `archives/${collectionIsAccessible?.id}/${linkId}_readability.txt`,
+ filePath: `archives/${collectionIsAccessible?.id}/${linkId}_readability.json`,
});
return { response: deleteLink, status: 200 };
diff --git a/lib/api/controllers/links/linkId/updateLinkById.ts b/lib/api/controllers/links/linkId/updateLinkById.ts
index 0f744b43..41fb54bc 100644
--- a/lib/api/controllers/links/linkId/updateLinkById.ts
+++ b/lib/api/controllers/links/linkId/updateLinkById.ts
@@ -104,8 +104,8 @@ export default async function updateLinkById(
);
await moveFile(
- `archives/${collectionIsAccessible?.id}/${linkId}_readability.txt`,
- `archives/${data.collection.id}/${linkId}_readability.txt`
+ `archives/${collectionIsAccessible?.id}/${linkId}_readability.json`,
+ `archives/${data.collection.id}/${linkId}_readability.json`
);
}
diff --git a/lib/api/storage/readFile.ts b/lib/api/storage/readFile.ts
index 59e1befe..01e6fdab 100644
--- a/lib/api/storage/readFile.ts
+++ b/lib/api/storage/readFile.ts
@@ -12,7 +12,8 @@ type ReturnContentTypes =
| "text/plain"
| "image/jpeg"
| "image/png"
- | "application/pdf";
+ | "application/pdf"
+ | "application/json";
export default async function readFile(filePath: string) {
let contentType: ReturnContentTypes;
@@ -58,8 +59,8 @@ export default async function readFile(filePath: string) {
contentType = "application/pdf";
} else if (filePath.endsWith(".png")) {
contentType = "image/png";
- } else if (filePath.endsWith("_readability.txt")) {
- contentType = "text/plain";
+ } else if (filePath.endsWith("_readability.json")) {
+ contentType = "application/json";
} else {
// if (filePath.endsWith(".jpg"))
contentType = "image/jpeg";
@@ -85,8 +86,8 @@ export default async function readFile(filePath: string) {
contentType = "application/pdf";
} else if (filePath.endsWith(".png")) {
contentType = "image/png";
- } else if (filePath.endsWith("_readability.txt")) {
- contentType = "text/plain";
+ } else if (filePath.endsWith("_readability.json")) {
+ contentType = "application/json";
} else {
// if (filePath.endsWith(".jpg"))
contentType = "image/jpeg";