From 45b5a0b0f030575482ca0c3822365ce037c0f7d9 Mon Sep 17 00:00:00 2001
From: Adam Procter <adamprocter@researchnot.es>
Date: Tue, 7 Apr 2020 13:36:39 +0100
Subject: [PATCH] 0.1.10

Added basic URL support. Syntax is baseurl.com/microcosm/microcosmname

If you have already assigned an object name on that device you will auto join, if you do not have one or localStorage is empty you will need to assign one.

microcosm and object name are now visible in the controlsLayer.vue component
---
 CHANGELOG.md                         | 16 ++++++++++++++++
 app/package.json                     |  2 +-
 app/src/components/ControlsLayer.vue | 21 ++++++++++++++++++++-
 app/src/components/OnBoard.vue       |  4 +++-
 app/src/views/Home.vue               |  8 --------
 5 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7a0b391..a4d7f05 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,19 @@
+# 0.1.10
+
+_7th April 2020_
+
+### Added
+
+- You can now visit a microcosm by using URL followed by https://baseurl.com/microcosm/**microcosmname**/ to direct someone to a specific microcosm, if they have used any microcosm before they will enter with there device/ object name. If they have not they need to assign a object name.
+
+### Changed
+
+- You can now see the microcosm you are connected to and your object name.
+
+### Fixed
+
+- Create/ Join a new microcosm now reloads URL dependant on whether in development or prodction enviroment
+
 # 0.1.9
 
 _26th March 2020_
diff --git a/app/package.json b/app/package.json
index 0eda5a1..d5c6f7a 100644
--- a/app/package.json
+++ b/app/package.json
@@ -1,6 +1,6 @@
 {
   "name": "nodenogg.in",
-  "version": "0.1.9",
+  "version": "0.1.10",
   "private": true,
   "scripts": {
     "serve": "vue-cli-service serve",
diff --git a/app/src/components/ControlsLayer.vue b/app/src/components/ControlsLayer.vue
index fe2dd18..b3f2b65 100644
--- a/app/src/components/ControlsLayer.vue
+++ b/app/src/components/ControlsLayer.vue
@@ -12,6 +12,11 @@
       Delete my contributions (inc. attachments) permanently
     </BaseButton>
       <BaseButton @click="handleConnection()">Online check</BaseButton>-->
+      <p class="who">
+        microcosm =
+        <b>{{ myMicrocosm }}</b> | object =
+        <b>{{ myClient }}</b>
+      </p>
     </div>
     <!-- TEMP: This was old code for possible pop up panes  -->
     <!-- <button on:click="popups.showPane = !popups.showPane"> -->
@@ -28,12 +33,18 @@
 <script>
 // This is for detecting offline issues
 var serverUrl = 'https://nodenogg.in'
+import { mapState } from 'vuex'
 
 export default {
   mounted() {
     window.addEventListener('online', this.handleConnection)
     window.addEventListener('offline', this.handleConnection)
   },
+
+  computed: mapState({
+    myMicrocosm: state => state.microcosm,
+    myClient: state => state.myclient
+  }),
   methods: {
     addNode() {
       this.$store.dispatch('addNode')
@@ -48,7 +59,11 @@ export default {
       // Hardcoded as when I set a URL had parameters the reload fails
       //location.assign('https://alpha.nodenogg.in/')
       //location.assign('http://localhost:8080/')
-      location.reload()
+
+      location.assign(
+        process.env.VUE_APP_HTTP + '://' + process.env.VUE_APP_URL + '/'
+      )
+      // location.reload()
     },
 
     deleteClient() {
@@ -104,6 +119,10 @@ export default {
   user-select: none;
 }
 
+.who {
+  color: white;
+}
+
 .btn-row {
   position: relative;
   margin-bottom: 5px;
diff --git a/app/src/components/OnBoard.vue b/app/src/components/OnBoard.vue
index 3a8c35b..2aba6ed 100644
--- a/app/src/components/OnBoard.vue
+++ b/app/src/components/OnBoard.vue
@@ -63,10 +63,12 @@
 var delay = 100
 var delaytwo = 100
 
+import Router from '@/router'
+
 export default {
   data: function() {
     return {
-      localmicrocosm: '',
+      localmicrocosm: Router.currentRoute.params.microcosm,
       clientid: '',
       parta: true,
       partb: false,
diff --git a/app/src/views/Home.vue b/app/src/views/Home.vue
index 135141a..5d8d2ea 100644
--- a/app/src/views/Home.vue
+++ b/app/src/views/Home.vue
@@ -1,12 +1,6 @@
 <template>
   <div class="home">
     <div v-if="clientset">
-      <p>
-        microcosm/
-        <b>{{ myMicrocosm }}</b> | client
-        <b>{{ myClient }}</b>
-      </p>
-
       <OtherNodeslayer
         v-for="value in otherNodes"
         v-bind:key="value.node_id"
@@ -74,8 +68,6 @@ export default {
     ControlsLayer
   },
   computed: mapState({
-    myMicrocosm: state => state.microcosm,
-    myClient: state => state.myclient,
     myNodes: state => state.myNodes,
     otherNodes: state => state.otherNodes,
     shortcutstate: state => state.shortcutstate
-- 
GitLab