Compare commits

..

4 commits

Author SHA1 Message Date
Magnus Åhall
2fece1ede4 Bumped to v4 2026-05-29 09:23:45 +02:00
Magnus Åhall
2582de90aa Fixed bug in root rendering 2026-05-29 09:23:33 +02:00
Magnus Åhall
bbce399bc3 Removed one more instance of /notes2 2026-05-29 09:07:04 +02:00
Magnus Åhall
f3e16207a6 Change /notes2 to / 2026-05-29 09:03:59 +02:00
9 changed files with 16 additions and 33 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
notes2
untracked

26
main.go
View file

@ -23,7 +23,7 @@ import (
"text/template"
)
const VERSION = "v3"
const VERSION = "v4"
const CONTEXT_USER = 1
const SYNC_PAGINATION = 200
@ -129,7 +129,6 @@ func main() { // {{{
}
http.HandleFunc("/", rootHandler)
http.HandleFunc("/notes2", pageNotes2)
http.HandleFunc("/login", pageLogin)
http.HandleFunc("/sync", pageSync)
http.HandleFunc("/offline", pageOffline)
@ -189,7 +188,13 @@ func rootHandler(w http.ResponseWriter, r *http.Request) { // {{{
// All URLs not specifically handled are routed to this function.
// Everything going here should be a static resource.
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
}
@ -245,15 +250,6 @@ func pageLogin(w http.ResponseWriter, r *http.Request) { // {{{
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) { // {{{
page := NewPage("sync")
@ -280,9 +276,9 @@ func actionSyncFromServer(w http.ResponseWriter, r *http.Request) { // {{{
}
/*
Log.Debug("/sync/from_server", "num_nodes", len(nodes), "maxSeq", maxSeq)
foo, _ := json.Marshal(nodes)
os.WriteFile(fmt.Sprintf("/tmp/nodes-%d.json", offset), foo, 0644)
Log.Debug("/sync/from_server", "num_nodes", len(nodes), "maxSeq", maxSeq)
foo, _ := json.Marshal(nodes)
os.WriteFile(fmt.Sprintf("/tmp/nodes-%d.json", offset), foo, 0644)
*/
j, _ := json.Marshal(struct {

View file

@ -316,7 +316,6 @@ n2-nodeui {
margin-bottom: 32px;
&:invalid {
background: #f5f5f5;
padding-top: 16px;
}
}

View file

@ -184,7 +184,7 @@ export class App {
}
if (!dontPush)
history.pushState({ nodeUUID }, '', `/notes2#${nodeUUID}`)
history.pushState({ nodeUUID }, '', `/#${nodeUUID}`)
const node = nodeStore.node(nodeUUID)
node.reset() // any modifications are discarded.
@ -249,7 +249,7 @@ class N2Crumb extends CustomHTMLElement {
this.label = label
this.uuid = uuid
this.elLink.href = `/notes2#${this.uuid}`
this.elLink.href = `/#${this.uuid}`
this.elLink.innerText = this.label
this.elLink.addEventListener('click', () => _mbus.dispatch("GO_TO_NODE", { nodeUUID: this.uuid, dontPush: false, dontExpand: true }))
}// }}}

File diff suppressed because one or more lines are too long

View file

@ -69,7 +69,7 @@ export class Notes2 extends Component {
}
if (!dontPush)
history.pushState({ nodeUUID }, '', `/notes2#${nodeUUID}`)
history.pushState({ nodeUUID }, '', `/#${nodeUUID}`)
// New node is fetched in order to retrieve content and files.
// Such data is unnecessary to transfer for tree/navigational purposes.

View file

@ -1,7 +1,6 @@
const CACHE_NAME = 'notes2-{{ .VERSION }}'
const CACHED_ASSETS = [
'/',
'/notes2',
'/offline',
'/css/{{ .VERSION }}/main.css',

View file

@ -16,10 +16,6 @@
"node_store": "/js/{{ .VERSION }}/node_store.mjs",
"node": "/js/{{ .VERSION }}/node.mjs",
"tree": "/js/{{ .VERSION }}/tree.mjs"
{{/*
"session": "/js/{{ .VERSION }}/session.mjs",
"ws": "/_js/{{ .VERSION }}/websocket.mjs"
*/}}
}
}
</script>
@ -33,8 +29,6 @@
import { MessageBus } from '/js/{{ .VERSION }}/mbus.mjs'
window._mbus = new MessageBus()
</script>
<script type="text/javascript" src="/js/{{ .VERSION }}/lib/sjcl.js"></script>
<script type="text/javascript" src="/js/{{ .VERSION }}/lib/fullcalendar.min.js"></script>
</head>
<body>
<div id="app">{{ block "page" . }}{{ end }}</div>

View file

@ -29,7 +29,7 @@ class Login {
const password = document.getElementById('password').value
API.authenticate(username, password)
.then(ans=>{
location.href = '/notes2'
location.href = '/'
})
.catch(e=>{
setTimeout(()=>this.errorDiv.innerText = e, 75)