2022-08-31 06:33:37 +05:00
|
|
|
/*
|
|
|
|
|
This file is part of the Notesnook project (https://notesnook.com/)
|
|
|
|
|
|
|
|
|
|
Copyright (C) 2022 Streetwriters (Private) Limited
|
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
2022-08-30 16:13:11 +05:00
|
|
|
|
2021-11-24 11:40:33 +05:00
|
|
|
import hosts from "../utils/constants";
|
|
|
|
|
|
2021-09-15 11:47:10 +05:00
|
|
|
export default class Debug {
|
|
|
|
|
strip(item) {
|
2022-08-15 10:57:25 +05:00
|
|
|
if (!item) return "{}";
|
2021-09-15 11:47:10 +05:00
|
|
|
return JSON.stringify({
|
2021-09-15 12:01:10 +05:00
|
|
|
title: !!item.title,
|
|
|
|
|
description: !!item.description,
|
|
|
|
|
headline: !!item.headline,
|
|
|
|
|
colored: !!item.color,
|
2021-09-15 11:47:10 +05:00
|
|
|
type: item.type,
|
|
|
|
|
notebooks: item.notebooks,
|
2022-08-15 10:57:25 +05:00
|
|
|
notes: item.notes,
|
|
|
|
|
noteIds: item.noteIds,
|
2021-09-15 11:47:10 +05:00
|
|
|
tags: item.tags,
|
|
|
|
|
id: item.id,
|
|
|
|
|
contentId: item.contentId,
|
2021-12-20 14:37:06 +05:00
|
|
|
dateModified: item.dateModified,
|
2021-09-15 11:47:10 +05:00
|
|
|
dateEdited: item.dateEdited,
|
|
|
|
|
dateDeleted: item.dateDeleted,
|
|
|
|
|
dateCreated: item.dateCreated,
|
2022-08-31 06:33:37 +05:00
|
|
|
additionalData: item.additionalData
|
2021-09-15 11:47:10 +05:00
|
|
|
});
|
|
|
|
|
}
|
2021-11-24 11:40:33 +05:00
|
|
|
|
2021-12-02 12:44:59 +05:00
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param {{
|
|
|
|
|
* title: string,
|
|
|
|
|
* body: string,
|
|
|
|
|
* userId: string
|
|
|
|
|
* }} reportData
|
2021-12-02 12:45:39 +05:00
|
|
|
* @returns {Promise<string>} link to the github issue
|
2021-12-02 12:44:59 +05:00
|
|
|
*/
|
|
|
|
|
async report(reportData) {
|
|
|
|
|
if (!reportData) return;
|
|
|
|
|
|
|
|
|
|
const { title, body, userId } = reportData;
|
2021-11-24 11:40:33 +05:00
|
|
|
const response = await fetch(`${hosts.ISSUES_HOST}/create/notesnook`, {
|
|
|
|
|
method: "POST",
|
|
|
|
|
headers: { "Content-Type": "application/json" },
|
2022-08-31 06:33:37 +05:00
|
|
|
body: JSON.stringify({ title, body, userId })
|
2021-11-24 11:40:33 +05:00
|
|
|
});
|
|
|
|
|
if (!response.ok) return;
|
|
|
|
|
const json = await response.json();
|
|
|
|
|
return json.url;
|
|
|
|
|
}
|
2021-09-15 11:47:10 +05:00
|
|
|
}
|