mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
refactor: migrate to theme-ui from rebass
This commit is contained in:
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import Debug from "../debug";
|
||||
import { noteTest, notebookTest, databaseTest } from "../../__tests__/utils";
|
||||
@@ -49,7 +50,7 @@ test("strip note with content", () =>
|
||||
|
||||
const content = await db.content.raw(note.contentId);
|
||||
note.additionalData = {
|
||||
content: db.debug.strip(normalizeItem(content)),
|
||||
content: db.debug.strip(normalizeItem(content))
|
||||
};
|
||||
|
||||
expect(debug.strip(normalizeItem(note))).toMatchSnapshot(
|
||||
@@ -91,7 +92,7 @@ test("reporting empty issue should return undefined", async () => {
|
||||
});
|
||||
|
||||
const SUCCESS_REPORT_RESPONSE = {
|
||||
url: "https://reported/",
|
||||
url: "https://reported/"
|
||||
};
|
||||
|
||||
test("reporting issue should return issue url", async () => {
|
||||
@@ -100,14 +101,14 @@ test("reporting issue should return issue url", async () => {
|
||||
const debug = new Debug();
|
||||
|
||||
fetch.mockResponseOnce(JSON.stringify(SUCCESS_REPORT_RESPONSE), {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
headers: { "Content-Type": "application/json" }
|
||||
});
|
||||
|
||||
expect(
|
||||
await debug.report({
|
||||
title: "I am title",
|
||||
body: "I am body",
|
||||
userId: "anything",
|
||||
userId: "anything"
|
||||
})
|
||||
).toBe(SUCCESS_REPORT_RESPONSE.url);
|
||||
|
||||
@@ -121,7 +122,7 @@ test("reporting invalid issue should return undefined", async () => {
|
||||
|
||||
fetch.mockResponseOnce(
|
||||
JSON.stringify({
|
||||
error_description: "Invalid issue.",
|
||||
error_description: "Invalid issue."
|
||||
}),
|
||||
{ status: 400, headers: { "Content-Type": "application/json" } }
|
||||
);
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
test.todo("skipped test");
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
test.todo("skipped test");
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
test.todo("skipped test");
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import Pricing from "../pricing";
|
||||
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import hosts from "../utils/constants";
|
||||
|
||||
@@ -37,7 +38,7 @@ export default class Debug {
|
||||
dateEdited: item.dateEdited,
|
||||
dateDeleted: item.dateDeleted,
|
||||
dateCreated: item.dateCreated,
|
||||
additionalData: item.additionalData,
|
||||
additionalData: item.additionalData
|
||||
});
|
||||
}
|
||||
|
||||
@@ -57,7 +58,7 @@ export default class Debug {
|
||||
const response = await fetch(`${hosts.ISSUES_HOST}/create/notesnook`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ title, body, userId }),
|
||||
body: JSON.stringify({ title, body, userId })
|
||||
});
|
||||
if (!response.ok) return;
|
||||
const json = await response.json();
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import Notes from "../collections/notes";
|
||||
import Storage from "../database/storage";
|
||||
@@ -181,7 +182,7 @@ class Database {
|
||||
|
||||
let token = await this.user.tokenManager.getAccessToken();
|
||||
this.evtSource = new NNEventSource(`${Constants.SSE_HOST}/sse`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
headers: { Authorization: `Bearer ${token}` }
|
||||
});
|
||||
|
||||
this.evtSource.onopen = async () => {
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import { filter, parse } from "liqe";
|
||||
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import http from "../utils/http";
|
||||
import constants from "../utils/constants";
|
||||
@@ -25,7 +26,7 @@ const ENDPOINTS = {
|
||||
enable: "/mfa",
|
||||
disable: "/mfa",
|
||||
recoveryCodes: "/mfa/codes",
|
||||
send: "/mfa/send",
|
||||
send: "/mfa/send"
|
||||
};
|
||||
|
||||
class MFAManager {
|
||||
@@ -53,7 +54,7 @@ class MFAManager {
|
||||
`${constants.AUTH_HOST}${ENDPOINTS.setup}`,
|
||||
{
|
||||
type,
|
||||
phoneNumber,
|
||||
phoneNumber
|
||||
},
|
||||
token
|
||||
);
|
||||
@@ -131,7 +132,7 @@ class MFAManager {
|
||||
return await http.post(
|
||||
`${constants.AUTH_HOST}${ENDPOINTS.send}`,
|
||||
{
|
||||
type: method,
|
||||
type: method
|
||||
},
|
||||
token
|
||||
);
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import { CURRENT_DATABASE_VERSION } from "../common";
|
||||
import Migrator from "../database/migrator";
|
||||
@@ -51,33 +52,33 @@ class Migrations {
|
||||
{ index: this._db.attachments.all, dbCollection: this._db.attachments },
|
||||
{
|
||||
index: this._db.notebooks.raw,
|
||||
dbCollection: this._db.notebooks,
|
||||
dbCollection: this._db.notebooks
|
||||
},
|
||||
{
|
||||
index: this._db.tags.raw,
|
||||
dbCollection: this._db.tags,
|
||||
dbCollection: this._db.tags
|
||||
},
|
||||
{
|
||||
index: this._db.colors.raw,
|
||||
dbCollection: this._db.colors,
|
||||
dbCollection: this._db.colors
|
||||
},
|
||||
{
|
||||
index: this._db.trash.raw,
|
||||
dbCollection: this._db.trash,
|
||||
dbCollection: this._db.trash
|
||||
},
|
||||
{
|
||||
index: content,
|
||||
dbCollection: this._db.content,
|
||||
dbCollection: this._db.content
|
||||
},
|
||||
{
|
||||
index: [this._db.settings.raw],
|
||||
dbCollection: this._db.settings,
|
||||
type: "settings",
|
||||
type: "settings"
|
||||
},
|
||||
{
|
||||
index: this._db.notes.raw,
|
||||
dbCollection: this._db.notes,
|
||||
},
|
||||
dbCollection: this._db.notes
|
||||
}
|
||||
];
|
||||
await this._migrator.migrate(collections, (item) => item, this.dbVersion);
|
||||
await this._db.storage.write("v", CURRENT_DATABASE_VERSION);
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import http from "../utils/http";
|
||||
import Constants from "../utils/constants";
|
||||
@@ -98,7 +99,7 @@ class Monographs {
|
||||
id: noteId,
|
||||
title: note.title,
|
||||
userId: user.id,
|
||||
selfDestruct: opts.selfDestruct,
|
||||
selfDestruct: opts.selfDestruct
|
||||
};
|
||||
|
||||
if (opts.password) {
|
||||
@@ -109,7 +110,7 @@ class Monographs {
|
||||
} else {
|
||||
monograph.content = JSON.stringify({
|
||||
type: content.type,
|
||||
data: content.data,
|
||||
data: content.data
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import { CLIENT_ID } from "../common";
|
||||
import hosts from "../utils/constants";
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
class Outbox {
|
||||
/**
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import http from "../utils/http";
|
||||
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
class Session {
|
||||
/**
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import { EV, EVENTS } from "../common";
|
||||
import id from "../utils/id";
|
||||
@@ -55,15 +56,15 @@ class Settings {
|
||||
);
|
||||
this._settings.groupOptions = {
|
||||
...this._settings.groupOptions,
|
||||
...item.groupOptions,
|
||||
...item.groupOptions
|
||||
};
|
||||
this._settings.toolbarConfig = {
|
||||
...this._settings.toolbarConfig,
|
||||
...item.toolbarConfig,
|
||||
...item.toolbarConfig
|
||||
};
|
||||
this._settings.aliases = {
|
||||
...this._settings.aliases,
|
||||
...item.aliases,
|
||||
...item.aliases
|
||||
};
|
||||
this._settings.dateModified = Date.now();
|
||||
} else {
|
||||
@@ -97,7 +98,7 @@ class Settings {
|
||||
: key === "tags"
|
||||
? "dateCreated"
|
||||
: "dateEdited",
|
||||
sortDirection: "desc",
|
||||
sortDirection: "desc"
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -184,7 +185,7 @@ class Settings {
|
||||
aliases: {},
|
||||
dateModified: 0,
|
||||
dateCreated: 0,
|
||||
...(settings || {}),
|
||||
...(settings || {})
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
databaseTest,
|
||||
TEST_NOTE,
|
||||
delay,
|
||||
StorageInterface,
|
||||
StorageInterface
|
||||
} from "../../../__tests__/utils";
|
||||
import Collector from "../collector";
|
||||
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import Database from "../../index";
|
||||
import { NodeStorageInterface } from "../../../__mocks__/node-storage.mock";
|
||||
@@ -52,10 +53,10 @@ test("case 3: Device A & B have unsynced changes but server has nothing", async
|
||||
const deviceB = await initializeDevice("deviceB");
|
||||
|
||||
const note1Id = await deviceA.notes.add({
|
||||
title: "Test note from device A",
|
||||
title: "Test note from device A"
|
||||
});
|
||||
const note2Id = await deviceB.notes.add({
|
||||
title: "Test note from device B",
|
||||
title: "Test note from device B"
|
||||
});
|
||||
|
||||
await syncAndWait(deviceA, deviceB);
|
||||
@@ -218,8 +219,8 @@ test("issue: colors are not properly created if multiple notes are synced togeth
|
||||
const id = await deviceA.notes.add({
|
||||
content: {
|
||||
type: "tiptap",
|
||||
data: `<p>deviceA=true</p>`,
|
||||
},
|
||||
data: `<p>deviceA=true</p>`
|
||||
}
|
||||
});
|
||||
noteIds.push(id);
|
||||
}
|
||||
@@ -287,7 +288,7 @@ test("issue: remove notebook reference from notes that are removed from topic du
|
||||
|
||||
const id = await deviceA.notebooks.add({
|
||||
title: "Notebook 1",
|
||||
topics: ["Topic 1"],
|
||||
topics: ["Topic 1"]
|
||||
});
|
||||
|
||||
await syncAndWait(deviceA, deviceB, false);
|
||||
@@ -334,7 +335,7 @@ async function initializeDevice(id, capabilities = []) {
|
||||
EV.subscribe(EVENTS.userCheckStatus, async (type) => {
|
||||
return {
|
||||
type,
|
||||
result: capabilities.indexOf(type) > -1,
|
||||
result: capabilities.indexOf(type) > -1
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import { checkIsUserPremium, CHECK_IDS, EVENTS } from "../../common";
|
||||
import { logger } from "../../logger";
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import { CURRENT_DATABASE_VERSION } from "../../common";
|
||||
import { logger } from "../../logger";
|
||||
@@ -44,7 +45,7 @@ class Collector {
|
||||
this._db.attachments.syncable,
|
||||
isForceSync
|
||||
),
|
||||
...this._collect("settings", [this._db.settings.raw], isForceSync),
|
||||
...this._collect("settings", [this._db.settings.raw], isForceSync)
|
||||
];
|
||||
|
||||
return { items, vaultKey: await this._db.vault._getKey() };
|
||||
@@ -80,7 +81,7 @@ class Collector {
|
||||
id: item.id,
|
||||
collectionId,
|
||||
deleted: true,
|
||||
dateModified: Date.now(),
|
||||
dateModified: Date.now()
|
||||
});
|
||||
} else if (isUnsynced && isSyncable) {
|
||||
prev.push({ ...item, collectionId });
|
||||
@@ -115,7 +116,7 @@ class Collector {
|
||||
return {
|
||||
id: item.id,
|
||||
v: CURRENT_DATABASE_VERSION,
|
||||
...(await this._serialize(item)),
|
||||
...(await this._serialize(item))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
class Conflicts {
|
||||
/**
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
EV,
|
||||
EVENTS,
|
||||
sendAttachmentsProgressEvent,
|
||||
sendSyncProgressEvent,
|
||||
sendSyncProgressEvent
|
||||
} from "../../common";
|
||||
import Constants from "../../utils/constants";
|
||||
import TokenManager from "../token-manager";
|
||||
@@ -130,8 +131,8 @@ class Sync {
|
||||
case signalr.LogLevel.Warning:
|
||||
return scopedLogger.warn(message);
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
.withHubProtocol(new MessagePackHubProtocol({ ignoreUndefined: true }))
|
||||
.withAutomaticReconnect()
|
||||
@@ -178,7 +179,7 @@ class Sync {
|
||||
this.logger.info("Data collected for sync", {
|
||||
newLastSynced,
|
||||
length: data.items.length,
|
||||
isEmpty: data.items.length <= 0,
|
||||
isEmpty: data.items.length <= 0
|
||||
});
|
||||
|
||||
const serverResponse = full ? await this.fetch(lastSynced) : null;
|
||||
@@ -243,7 +244,7 @@ class Sync {
|
||||
});
|
||||
},
|
||||
complete: () => {},
|
||||
error: reject,
|
||||
error: reject
|
||||
});
|
||||
});
|
||||
|
||||
@@ -308,7 +309,7 @@ class Sync {
|
||||
current: i,
|
||||
total,
|
||||
items,
|
||||
types,
|
||||
types
|
||||
});
|
||||
|
||||
if (result) {
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import { migrations } from "../../migrations";
|
||||
import SparkMD5 from "spark-md5";
|
||||
@@ -36,17 +37,17 @@ class Merger {
|
||||
threshold: 1000,
|
||||
get: () => this._db.settings.raw,
|
||||
set: (item) => this._db.settings.merge(item),
|
||||
conflict: (_local, remote) => this._db.settings.merge(remote),
|
||||
conflict: (_local, remote) => this._db.settings.merge(remote)
|
||||
},
|
||||
note: {
|
||||
get: (id) => this._db.notes.note(id),
|
||||
set: (item) => this._db.notes.merge(item),
|
||||
set: (item) => this._db.notes.merge(item)
|
||||
},
|
||||
notebook: {
|
||||
threshold: 1000,
|
||||
get: (id) => this._db.notebooks.notebook(id),
|
||||
set: (item) => this._db.notebooks.merge(item),
|
||||
conflict: (_local, remote) => this._db.notebooks.merge(remote),
|
||||
conflict: (_local, remote) => this._db.notebooks.merge(remote)
|
||||
},
|
||||
content: {
|
||||
threshold: process.env.NODE_ENV === "test" ? 6 * 1000 : 60 * 1000,
|
||||
@@ -79,7 +80,7 @@ class Merger {
|
||||
await this._db.notes.add({ id: local.noteId, conflicted: true });
|
||||
await this._db.storage.write("hasConflicts", true);
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
attachment: {
|
||||
set: async (item) => {
|
||||
@@ -111,12 +112,12 @@ class Merger {
|
||||
);
|
||||
}
|
||||
await this._db.attachments.merge(remoteAttachment);
|
||||
},
|
||||
}
|
||||
},
|
||||
vaultKey: {
|
||||
set: async (vaultKey) =>
|
||||
this._db.vault._setKey(await this._deserialize(vaultKey, false)),
|
||||
},
|
||||
this._db.vault._setKey(await this._deserialize(vaultKey, false))
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -203,7 +204,7 @@ class Merger {
|
||||
isModified,
|
||||
timeDiff,
|
||||
remote: remoteItem.dateModified,
|
||||
local: localItem.dateModified,
|
||||
local: localItem.dateModified
|
||||
});
|
||||
|
||||
await markAsConflicted(localItem, remoteItem);
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import set from "../../utils/set";
|
||||
import { qclone } from "qclone";
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
function areAllEmpty(obj) {
|
||||
for (let key in obj) {
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import http from "../utils/http";
|
||||
import constants from "../utils/constants";
|
||||
@@ -26,7 +27,7 @@ const ENDPOINTS = {
|
||||
token: "/connect/token",
|
||||
revoke: "/connect/revocation",
|
||||
temporaryToken: "/account/token",
|
||||
logout: "/account/logout",
|
||||
logout: "/account/logout"
|
||||
};
|
||||
|
||||
class TokenManager {
|
||||
@@ -45,7 +46,7 @@ class TokenManager {
|
||||
if (!token) return;
|
||||
|
||||
this.logger.info("Access token requested", {
|
||||
accessToken: token.access_token.slice(0, 10),
|
||||
accessToken: token.access_token.slice(0, 10)
|
||||
});
|
||||
|
||||
if (forceRenew || (renew && this._isTokenExpired(token))) {
|
||||
@@ -88,7 +89,7 @@ class TokenManager {
|
||||
refresh_token,
|
||||
grant_type: "refresh_token",
|
||||
scope: scope,
|
||||
client_id: "notesnook",
|
||||
client_id: "notesnook"
|
||||
}
|
||||
);
|
||||
await this.saveToken(refreshTokenResponse);
|
||||
@@ -118,7 +119,7 @@ class TokenManager {
|
||||
await http.post(`${constants.AUTH_HOST}${ENDPOINTS.temporaryToken}`, {
|
||||
authorization_code: authCode,
|
||||
user_id: userId,
|
||||
client_id: "notesnook",
|
||||
client_id: "notesnook"
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import "../types";
|
||||
import http from "../utils/http";
|
||||
@@ -32,7 +33,7 @@ const ENDPOINTS = {
|
||||
revoke: "/connect/revocation",
|
||||
recoverAccount: "/account/recover",
|
||||
resetUser: "/users/reset",
|
||||
activateTrial: "/subscriptions/trial",
|
||||
activateTrial: "/subscriptions/trial"
|
||||
};
|
||||
|
||||
class UserManager {
|
||||
@@ -69,7 +70,7 @@ class UserManager {
|
||||
await http.post(`${constants.API_HOST}${ENDPOINTS.signup}`, {
|
||||
email,
|
||||
password: hashedPassword,
|
||||
client_id: "notesnook",
|
||||
client_id: "notesnook"
|
||||
});
|
||||
EV.publish(EVENTS.userSignedUp);
|
||||
return await this._login({ email, password, hashedPassword });
|
||||
@@ -99,14 +100,14 @@ class UserManager {
|
||||
scope: "notesnook.sync offline_access openid IdentityServerApi",
|
||||
client_id: "notesnook",
|
||||
"mfa:code": code,
|
||||
"mfa:method": method,
|
||||
"mfa:method": method
|
||||
})
|
||||
);
|
||||
|
||||
const user = await this.fetchUser();
|
||||
await this._storage.deriveCryptoKey(`_uk_@${user.email}`, {
|
||||
password,
|
||||
salt: user.salt,
|
||||
salt: user.salt
|
||||
});
|
||||
|
||||
EV.publish(EVENTS.userLoggedIn, user);
|
||||
@@ -230,13 +231,13 @@ class UserManager {
|
||||
changePassword(oldPassword, newPassword) {
|
||||
return this._updatePassword("change_password", {
|
||||
old_password: oldPassword,
|
||||
new_password: newPassword,
|
||||
new_password: newPassword
|
||||
});
|
||||
}
|
||||
|
||||
resetPassword(newPassword) {
|
||||
return this._updatePassword("reset_password", {
|
||||
new_password: newPassword,
|
||||
new_password: newPassword
|
||||
});
|
||||
}
|
||||
|
||||
@@ -298,7 +299,7 @@ class UserManager {
|
||||
recoverAccount(email) {
|
||||
return http.post(`${constants.AUTH_HOST}${ENDPOINTS.recoverAccount}`, {
|
||||
email,
|
||||
client_id: "notesnook",
|
||||
client_id: "notesnook"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -335,7 +336,7 @@ class UserManager {
|
||||
|
||||
await this._storage.deriveCryptoKey(`_uk_@${email}`, {
|
||||
password: new_password,
|
||||
salt,
|
||||
salt
|
||||
});
|
||||
|
||||
if (!(await this.resetUser(false))) return;
|
||||
@@ -362,7 +363,7 @@ class UserManager {
|
||||
{
|
||||
type,
|
||||
old_password,
|
||||
new_password,
|
||||
new_password
|
||||
},
|
||||
token
|
||||
);
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import { CHECK_IDS, EV, EVENTS, checkIsUserPremium } from "../common";
|
||||
import { tinyToTiptap } from "../migrations";
|
||||
@@ -53,7 +54,7 @@ export default class Vault {
|
||||
this.ERRORS = {
|
||||
noVault: "ERR_NO_VAULT",
|
||||
vaultLocked: "ERR_VAULT_LOCKED",
|
||||
wrongPassword: "ERR_WRONG_PASSWORD",
|
||||
wrongPassword: "ERR_WRONG_PASSWORD"
|
||||
};
|
||||
EV.subscribe(EVENTS.userLoggedOut, () => {
|
||||
this._password = null;
|
||||
@@ -113,7 +114,7 @@ export default class Vault {
|
||||
contentItems.push({
|
||||
...content,
|
||||
id: note.contentId,
|
||||
noteId: note.id,
|
||||
noteId: note.id
|
||||
});
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
@@ -237,7 +238,7 @@ export default class Vault {
|
||||
id: contentId,
|
||||
sessionId,
|
||||
data: encryptedContent,
|
||||
type,
|
||||
type
|
||||
});
|
||||
}
|
||||
|
||||
@@ -249,7 +250,7 @@ export default class Vault {
|
||||
|
||||
const content = {
|
||||
type: encryptedContent.type,
|
||||
data: JSON.parse(decryptedContent),
|
||||
data: JSON.parse(decryptedContent)
|
||||
};
|
||||
|
||||
// #MIGRATION: convert tiny to tiptap
|
||||
@@ -281,7 +282,7 @@ export default class Vault {
|
||||
const content = await this._db.content.extractAttachments({
|
||||
data,
|
||||
type,
|
||||
noteId: id,
|
||||
noteId: id
|
||||
});
|
||||
data = content.data;
|
||||
type = content.type;
|
||||
@@ -298,7 +299,7 @@ export default class Vault {
|
||||
favorite: note.favorite,
|
||||
localOnly: note.localOnly,
|
||||
readonly: note.readonly,
|
||||
dateEdited: Date.now(),
|
||||
dateEdited: Date.now()
|
||||
});
|
||||
}
|
||||
|
||||
@@ -313,7 +314,7 @@ export default class Vault {
|
||||
locked: false,
|
||||
headline: note.headline,
|
||||
contentId: note.contentId,
|
||||
content,
|
||||
content
|
||||
});
|
||||
// await this._db.content.add({ id: note.contentId, data: content });
|
||||
return;
|
||||
@@ -321,7 +322,7 @@ export default class Vault {
|
||||
|
||||
return {
|
||||
...note,
|
||||
content,
|
||||
content
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user