From 0d282bed7d1abd087cb0c58cf7b4bf08caf1c17d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Tron=C3=AD=C4=8Dek?= Date: Mon, 23 Nov 2020 15:20:59 +0100 Subject: [PATCH 1/4] User to code keyword --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index 5e476c5..e4404aa 100644 --- a/main.js +++ b/main.js @@ -87,7 +87,7 @@ function createWindow() { }); ipcMain.on("recieve-code", (event, code) => { axios - .get(`http://uni.hys.cz/includes/get-api?user=${code}`) + .get(`http://uni.hys.cz/includes/get-api?code=${code}`) .then((res) => { const url = res.data; // send message to index.html From f9dbcec62206dadfa3e4c90f21dfebeabd18ec06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Tron=C3=AD=C4=8Dek?= Date: Mon, 23 Nov 2020 15:25:55 +0100 Subject: [PATCH 2/4] Use API v 2.0 --- assets/js/clip.js | 2 +- main.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/js/clip.js b/assets/js/clip.js index 8a4a914..b7e6190 100644 --- a/assets/js/clip.js +++ b/assets/js/clip.js @@ -32,7 +32,7 @@ function sendURL(urlInput = document.getElementById("search-input").value) { ipcRenderer.on("asynchronous-reply", (_event, code) => { if (code != "") { - document.getElementById("code").innerText = + document.getElementById("code").innerHTML = "code: " + code + ""; } else { console.log("Code is not valid"); diff --git a/main.js b/main.js index e4404aa..8d4d3e8 100644 --- a/main.js +++ b/main.js @@ -79,17 +79,17 @@ function createWindow() { // receive message from index.html ipcMain.on("asynchronous-message", (event, url) => { - axios.get(`http://uni.hys.cz/includes/api?url=${url}`).then((res) => { - const code = res.data; + axios.get(`https://link.mannoviny.cz/includes/api?url=${url}`).then((res) => { + const code = res.data.result; // send message to index.html event.sender.send("asynchronous-reply", code); }); }); ipcMain.on("recieve-code", (event, code) => { axios - .get(`http://uni.hys.cz/includes/get-api?code=${code}`) + .get(`https://link.mannoviny.cz/includes/get-api?code=${code}`) .then((res) => { - const url = res.data; + const url = res.data.result; // send message to index.html event.sender.send("url-reply", url); }); From d5073edc1a2533291ebc80f3e70ca8b8fba54c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Tron=C3=AD=C4=8Dek?= Date: Mon, 23 Nov 2020 15:29:02 +0100 Subject: [PATCH 3/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e19bfd..7d243d2 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Interclip desktop client Keyboard shortcuts: - * ```Ctrl(Command)+C``` = copy code +* ```Ctrl(Command)+C``` = copy code (BETA) Download for Windows (click on image below or download from releases) From c4ce5cc220fdcaaab97eb0135870900045c57543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Tron=C3=AD=C4=8Dek?= Date: Mon, 23 Nov 2020 15:35:44 +0100 Subject: [PATCH 4/4] Endpoint in one place --- main.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index 8d4d3e8..61d402c 100644 --- a/main.js +++ b/main.js @@ -20,6 +20,8 @@ if (setupEvents.handleSquirrelEvent()) { return; } +const endpoint = "https://link.mannoviny.cz"; + function createWindow() { // Create the browser window. win = new BrowserWindow({ @@ -62,7 +64,7 @@ function createWindow() { { label: "About", click() { - shell.openExternal("http://uni.hys.cz/about"); + shell.openExternal(`${endpoint}/about`); }, }, { type: "separator" }, @@ -79,7 +81,7 @@ function createWindow() { // receive message from index.html ipcMain.on("asynchronous-message", (event, url) => { - axios.get(`https://link.mannoviny.cz/includes/api?url=${url}`).then((res) => { + axios.get(`${endpoint}/includes/api?url=${url}`).then((res) => { const code = res.data.result; // send message to index.html event.sender.send("asynchronous-reply", code); @@ -87,7 +89,7 @@ function createWindow() { }); ipcMain.on("recieve-code", (event, code) => { axios - .get(`https://link.mannoviny.cz/includes/get-api?code=${code}`) + .get(`${endpoint}/includes/get-api?code=${code}`) .then((res) => { const url = res.data.result; // send message to index.html