Change /notes2 to /
This commit is contained in:
parent
662053e750
commit
f3e16207a6
5 changed files with 10 additions and 16 deletions
17
main.go
17
main.go
|
|
@ -129,7 +129,6 @@ func main() { // {{{
|
||||||
}
|
}
|
||||||
|
|
||||||
http.HandleFunc("/", rootHandler)
|
http.HandleFunc("/", rootHandler)
|
||||||
http.HandleFunc("/notes2", pageNotes2)
|
|
||||||
http.HandleFunc("/login", pageLogin)
|
http.HandleFunc("/login", pageLogin)
|
||||||
http.HandleFunc("/sync", pageSync)
|
http.HandleFunc("/sync", pageSync)
|
||||||
http.HandleFunc("/offline", pageOffline)
|
http.HandleFunc("/offline", pageOffline)
|
||||||
|
|
@ -189,9 +188,14 @@ func rootHandler(w http.ResponseWriter, r *http.Request) { // {{{
|
||||||
// All URLs not specifically handled are routed to this function.
|
// All URLs not specifically handled are routed to this function.
|
||||||
// Everything going here should be a static resource.
|
// Everything going here should be a static resource.
|
||||||
if r.URL.Path == "/" {
|
if r.URL.Path == "/" {
|
||||||
http.Redirect(w, r, "/notes2", http.StatusSeeOther)
|
page := NewPage("notes2")
|
||||||
|
|
||||||
|
err := Webengine.Render(page, w, r)
|
||||||
|
if err != nil {
|
||||||
|
w.Write([]byte(err.Error()))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Webengine.StaticResource(w, r)
|
Webengine.StaticResource(w, r)
|
||||||
} // }}}
|
} // }}}
|
||||||
|
|
@ -245,15 +249,6 @@ func pageLogin(w http.ResponseWriter, r *http.Request) { // {{{
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} // }}}
|
} // }}}
|
||||||
func pageNotes2(w http.ResponseWriter, r *http.Request) { // {{{
|
|
||||||
page := NewPage("notes2")
|
|
||||||
|
|
||||||
err := Webengine.Render(page, w, r)
|
|
||||||
if err != nil {
|
|
||||||
w.Write([]byte(err.Error()))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} // }}}
|
|
||||||
func pageSync(w http.ResponseWriter, r *http.Request) { // {{{
|
func pageSync(w http.ResponseWriter, r *http.Request) { // {{{
|
||||||
page := NewPage("sync")
|
page := NewPage("sync")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ class N2Crumb extends CustomHTMLElement {
|
||||||
this.label = label
|
this.label = label
|
||||||
this.uuid = uuid
|
this.uuid = uuid
|
||||||
|
|
||||||
this.elLink.href = `/notes2#${this.uuid}`
|
this.elLink.href = `/#${this.uuid}`
|
||||||
this.elLink.innerText = this.label
|
this.elLink.innerText = this.label
|
||||||
this.elLink.addEventListener('click', () => _mbus.dispatch("GO_TO_NODE", { nodeUUID: this.uuid, dontPush: false, dontExpand: true }))
|
this.elLink.addEventListener('click', () => _mbus.dispatch("GO_TO_NODE", { nodeUUID: this.uuid, dontPush: false, dontExpand: true }))
|
||||||
}// }}}
|
}// }}}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ export class Notes2 extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dontPush)
|
if (!dontPush)
|
||||||
history.pushState({ nodeUUID }, '', `/notes2#${nodeUUID}`)
|
history.pushState({ nodeUUID }, '', `/#${nodeUUID}`)
|
||||||
|
|
||||||
// New node is fetched in order to retrieve content and files.
|
// New node is fetched in order to retrieve content and files.
|
||||||
// Such data is unnecessary to transfer for tree/navigational purposes.
|
// Such data is unnecessary to transfer for tree/navigational purposes.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
const CACHE_NAME = 'notes2-{{ .VERSION }}'
|
const CACHE_NAME = 'notes2-{{ .VERSION }}'
|
||||||
const CACHED_ASSETS = [
|
const CACHED_ASSETS = [
|
||||||
'/',
|
'/',
|
||||||
'/notes2',
|
|
||||||
'/offline',
|
'/offline',
|
||||||
|
|
||||||
'/css/{{ .VERSION }}/main.css',
|
'/css/{{ .VERSION }}/main.css',
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class Login {
|
||||||
const password = document.getElementById('password').value
|
const password = document.getElementById('password').value
|
||||||
API.authenticate(username, password)
|
API.authenticate(username, password)
|
||||||
.then(ans=>{
|
.then(ans=>{
|
||||||
location.href = '/notes2'
|
location.href = '/'
|
||||||
})
|
})
|
||||||
.catch(e=>{
|
.catch(e=>{
|
||||||
setTimeout(()=>this.errorDiv.innerText = e, 75)
|
setTimeout(()=>this.errorDiv.innerText = e, 75)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue