From 65f4f6627b2a4fd64745aa012323ce6ee82a1d1a Mon Sep 17 00:00:00 2001 From: Kevin Bohorquez Date: Mon, 22 May 2023 21:21:59 -0500 Subject: [PATCH 1/2] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4cce9c3..c136105 100644 --- a/README.md +++ b/README.md @@ -89,8 +89,9 @@ in mode single file just add   #include <http/veridic.hpp> and ac | Active http Request | | ----- | -|| - +|| + +


From cc55509fa88e11064cb8e260e17d13f7babf6cec Mon Sep 17 00:00:00 2001 From: scyth3-c Date: Tue, 23 May 2023 12:07:01 -0500 Subject: [PATCH 2/2] fix colab flow --- src/components/basecanvas.vue | 13 +++++------- src/store.js | 37 ++++++++++++++++++----------------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/components/basecanvas.vue b/src/components/basecanvas.vue index 06203f6..15268e3 100644 --- a/src/components/basecanvas.vue +++ b/src/components/basecanvas.vue @@ -314,24 +314,21 @@ export default { } const codespace = params.get('codespace'); - if(this.$store.state.visibles.colab && codespace && this.$store.state.isHost == false){ + + if(this.$store.state.visibles.colab && codespace){ + this.$store.state.visibles.codespace = codespace this.$store.dispatch('setColab', false) this.$store.dispatch("extract_codespace", codespace) this.$store.dispatch('toColabClient', codespace) this.$store.dispatch('socketOn', this) } - if(codespace && this.$store.state.visibles.codespace == "null" && this.$store.state.isHost == false){ - + if(codespace && this.$store.state.visibles.codespace == "null"){ + this.$store.state.visibles.codespace = codespace this.$store.dispatch('setColab', false) this.$store.dispatch("extract_codespace", codespace) this.$store.dispatch('socketOn', this) } - - if(this.$store.state.isHost){ - this.$store.dispatch('socketOn', this) - } - }, mounted() { this.local_widthQuery.addEventListener('change',()=>{ diff --git a/src/store.js b/src/store.js index 993d20c..26e95f7 100644 --- a/src/store.js +++ b/src/store.js @@ -32,7 +32,10 @@ export default new Vuex.Store({ headers: "iostream string", usecurl: "off", isSocketActive: false, - isHost: JSON.parse(localStorage.getItem("o.isHost")) == undefined ? false : JSON.parse(localStorage.getItem("o.isHost")), + + isClient: JSON.parse(localStorage.getItem("o.isClient")) == undefined ? false : JSON.parse(localStorage.getItem("o.isClient")), + isHost: JSON.parse(localStorage.getItem("o.isHost")) == undefined ? false : JSON.parse(localStorage.getItem("o.isHost")), + visibles: { options: JSON.parse(localStorage.getItem("v.options")) == undefined ? true : JSON.parse(localStorage.getItem("v.options")) , addons: JSON.parse(localStorage.getItem("v.addons")) == undefined ? true : JSON.parse(localStorage.getItem("v.addons")), @@ -634,23 +637,26 @@ int main() { }, async internal_colab_clock({state,commit}, enviroment){ - clearTimeout(state.timer); + clearTimeout(state.timer); state.timer = setTimeout(async () => { let codebase = state.codeSpaces[state.actualCodeSpace].code await axios.put(`${state.API}codespace/update?id=${state.visibles.codespace}`, { code: codebase }); - enviroment.$socketio.emit('UpdateCodeSpace', state.visibles.codespace) - }, 500); + }, 1500); }, - async socketOn({state, dispatch}, enviroment){ + async socketOn({state}, enviroment){ + + console.log(state.visibles.colab, "--", state.visibles.codespace) + if(state.visibles.colab && state.visibles.codespace != "null"){ enviroment.$socketio.on('actualizacion_base', async (args)=>{ if(args == state.visibles.codespace){ - dispatch("extract_codespace", args) + const code = await axios.get(`${state.API}codespace/extract?id=${args}`); + state.codeSpaces[0].code = code.data.code } }); } @@ -676,11 +682,11 @@ int main() { data: { code: codeBase, codespace: state.identity, time: new Date().getDate().toString()}, }); - localStorage.setItem("o.isHost", true) localStorage.setItem("v.codespace", String(query?.data || undefined) ) state.visibles.codespace = String(query?.data) state.share.codespace = window.location.origin + "?codespace="+query.data commit('setColabUrl') + window.location.reload(true) }, toColabClient({state}, codespace){ @@ -689,16 +695,6 @@ int main() { state.visibles.colab = true }, - async extract_codespace({state, commit}, id){ - const code = await axios.get(`${state.API}codespace/extract?id=${id}`); - console.log(code.data) - if(code?.data != undefined) { - state.codeSpaces[0].code = code?.data.code - } else{ - return; - } - }, - async share({state,commit}){ let code = state.codeSpaces[state.actualCodeSpace].code; @@ -721,7 +717,12 @@ int main() { state.share_id = data.data } - }, + }, + + async extract_codespace({state, commit}, id){ + const code = await axios.get(`${state.API}codespace/extract?id=${id}`); + state.codeSpaces[0].code = code?.data.code + }, async extract_notecode({state,commit}, id){ const nota = await axios.get(`${state.API}notes/show?id=${id}`);