Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: add issue reporting api endpoint

thecodrr5d198e9ea364
diff --git a/packages/core/api/debug.js b/packages/core/api/debug.js
index 7d849be41..050e99134 100644
--- a/packages/core/api/debug.js
+++ b/packages/core/api/debug.js
@@ -1,3 +1,5 @@
+import hosts from "../utils/constants";
+
export default class Debug {
strip(item) {
return JSON.stringify({
@@ -16,4 +18,15 @@ export default class Debug {
additionalData: item.additionalData,
});
}
+
+ async report(title, body) {
+ const response = await fetch(`${hosts.ISSUES_HOST}/create/notesnook`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ title, body }),
+ });
+ if (!response.ok) return;
+ const json = await response.json();
+ return json.url;
+ }
}
diff --git a/packages/core/utils/constants.js b/packages/core/utils/constants.js
index 29536885c..033b92f39 100644
--- a/packages/core/utils/constants.js
+++ b/packages/core/utils/constants.js
@@ -15,6 +15,10 @@ const hosts = {
process.env.NODE_ENV === "production"
? "https://subscriptions.streetwriters.co"
: "http://localhost:9264",
+ ISSUES_HOST:
+ process.env.NODE_ENV === "production"
+ ? "https://issues.streetwriters.co"
+ : "http://localhost:2624",
};
export default hosts;