1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 11:46:16 +00:00

Fix untracked images for new hyphae

This commit is contained in:
bouncepaw 2020-10-19 01:26:05 +05:00
parent bc3de51543
commit cbb7a02c84
2 changed files with 64 additions and 60 deletions

View File

@ -153,20 +153,22 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) {
return return
} }
if !isOld { if !isOld {
HyphaStorage[hyphaName] = &HyphaData{ hd := HyphaData{
textType: TextGemini, textType: TextGemini,
textPath: fullPath, textPath: fullPath,
} }
HyphaStorage[hyphaName] = &hd
hyphaData = &hd
} else { } else {
hyphaData.textType = TextGemini hyphaData.textType = TextGemini
hyphaData.textPath = fullPath hyphaData.textPath = fullPath
} }
http.Redirect(w, rq, "/page/"+hyphaName, http.StatusSeeOther)
history.Operation(history.TypeEditText). history.Operation(history.TypeEditText).
WithFiles(fullPath). WithFiles(fullPath).
WithMsg(fmt.Sprintf("Edit %s", hyphaName)). WithMsg(fmt.Sprintf("Edit %s", hyphaName)).
WithSignature("anon"). WithSignature("anon").
Apply() Apply()
http.Redirect(w, rq, "/page/"+hyphaName, http.StatusSeeOther)
} }
// handlerUploadBinary uploads a new binary part for the hypha. // handlerUploadBinary uploads a new binary part for the hypha.
@ -203,10 +205,12 @@ func handlerUploadBinary(w http.ResponseWriter, rq *http.Request) {
log.Println(err) log.Println(err)
} }
if !isOld { if !isOld {
HyphaStorage[hyphaName] = &HyphaData{ hd := HyphaData{
binaryPath: fullPath, binaryPath: fullPath,
binaryType: mimeType, binaryType: mimeType,
} }
HyphaStorage[hyphaName] = &hd
hyphaData = &hd
} else { } else {
if hyphaData.binaryPath != fullPath { if hyphaData.binaryPath != fullPath {
if err := history.Rename(hyphaData.binaryPath, fullPath); err != nil { if err := history.Rename(hyphaData.binaryPath, fullPath); err != nil {
@ -224,10 +228,10 @@ func handlerUploadBinary(w http.ResponseWriter, rq *http.Request) {
return return
} }
log.Println("Written", len(data), "of binary data for", hyphaName, "to path", fullPath) log.Println("Written", len(data), "of binary data for", hyphaName, "to path", fullPath)
http.Redirect(w, rq, "/page/"+hyphaName, http.StatusSeeOther)
history.Operation(history.TypeEditText). history.Operation(history.TypeEditText).
WithFiles(fullPath, hyphaData.binaryPath). WithFiles(fullPath, hyphaData.binaryPath).
WithMsg(fmt.Sprintf("Upload binary part for %s with type %s", hyphaName, mimeType.Mime())). WithMsg(fmt.Sprintf("Upload binary part for %s with type %s", hyphaName, mimeType.Mime())).
WithSignature("anon"). WithSignature("anon").
Apply() Apply()
http.Redirect(w, rq, "/page/"+hyphaName, http.StatusSeeOther)
} }

View File

@ -1,151 +1,151 @@
// Code generated by qtc from "http_delete.qtpl". DO NOT EDIT. // Code generated by qtc from "delete.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details. // See https://github.com/valyala/quicktemplate for details.
// This dialog is to be shown to a user when they try to delete a hypha. // This dialog is to be shown to a user when they try to delete a hypha.
//line templates/http_delete.qtpl:2 //line templates/delete.qtpl:2
package templates package templates
//line templates/http_delete.qtpl:2 //line templates/delete.qtpl:2
import ( import (
qtio422016 "io" qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate" qt422016 "github.com/valyala/quicktemplate"
) )
//line templates/http_delete.qtpl:2 //line templates/delete.qtpl:2
var ( var (
_ = qtio422016.Copy _ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer _ = qt422016.AcquireByteBuffer
) )
//line templates/http_delete.qtpl:2 //line templates/delete.qtpl:2
func StreamDeleteAskHTML(qw422016 *qt422016.Writer, hyphaName string, isOld bool) { func StreamDeleteAskHTML(qw422016 *qt422016.Writer, hyphaName string, isOld bool) {
//line templates/http_delete.qtpl:2 //line templates/delete.qtpl:2
qw422016.N().S(` qw422016.N().S(`
<main> <main>
`) `)
//line templates/http_delete.qtpl:4 //line templates/delete.qtpl:4
streamnavHTML(qw422016, hyphaName, "delete-ask") streamnavHTML(qw422016, hyphaName, "delete-ask")
//line templates/http_delete.qtpl:4 //line templates/delete.qtpl:4
qw422016.N().S(` qw422016.N().S(`
`) `)
//line templates/http_delete.qtpl:5 //line templates/delete.qtpl:5
if isOld { if isOld {
//line templates/http_delete.qtpl:5 //line templates/delete.qtpl:5
qw422016.N().S(` qw422016.N().S(`
<section> <section>
<h1>Delete `) <h1>Delete `)
//line templates/http_delete.qtpl:7 //line templates/delete.qtpl:7
qw422016.E().S(hyphaName) qw422016.E().S(hyphaName)
//line templates/http_delete.qtpl:7 //line templates/delete.qtpl:7
qw422016.N().S(`?</h1> qw422016.N().S(`?</h1>
<p>Do you really want to delete hypha <em>`) <p>Do you really want to delete hypha <em>`)
//line templates/http_delete.qtpl:8 //line templates/delete.qtpl:8
qw422016.E().S(hyphaName) qw422016.E().S(hyphaName)
//line templates/http_delete.qtpl:8 //line templates/delete.qtpl:8
qw422016.N().S(`</em>?</p> qw422016.N().S(`</em>?</p>
<p>In this version of MycorrhizaWiki you cannot undelete a deleted hypha but the history can still be accessed.</p> <p>In this version of MycorrhizaWiki you cannot undelete a deleted hypha but the history can still be accessed.</p>
<p><a href="/delete-confirm/`) <p><a href="/delete-confirm/`)
//line templates/http_delete.qtpl:10 //line templates/delete.qtpl:10
qw422016.E().S(hyphaName) qw422016.E().S(hyphaName)
//line templates/http_delete.qtpl:10 //line templates/delete.qtpl:10
qw422016.N().S(`"><strong>Confirm</strong></a></p> qw422016.N().S(`"><strong>Confirm</strong></a></p>
<p><a href="/page/`) <p><a href="/page/`)
//line templates/http_delete.qtpl:11 //line templates/delete.qtpl:11
qw422016.E().S(hyphaName) qw422016.E().S(hyphaName)
//line templates/http_delete.qtpl:11 //line templates/delete.qtpl:11
qw422016.N().S(`">Cancel</a></p> qw422016.N().S(`">Cancel</a></p>
</section> </section>
`) `)
//line templates/http_delete.qtpl:13 //line templates/delete.qtpl:13
} else { } else {
//line templates/http_delete.qtpl:13 //line templates/delete.qtpl:13
qw422016.N().S(` qw422016.N().S(`
`) `)
//line templates/http_delete.qtpl:14 //line templates/delete.qtpl:14
streamcannotDeleteDueToNonExistence(qw422016, hyphaName) streamcannotDeleteDueToNonExistence(qw422016, hyphaName)
//line templates/http_delete.qtpl:14 //line templates/delete.qtpl:14
qw422016.N().S(` qw422016.N().S(`
`) `)
//line templates/http_delete.qtpl:15 //line templates/delete.qtpl:15
} }
//line templates/http_delete.qtpl:15 //line templates/delete.qtpl:15
qw422016.N().S(` qw422016.N().S(`
</main> </main>
`) `)
//line templates/http_delete.qtpl:17 //line templates/delete.qtpl:17
} }
//line templates/http_delete.qtpl:17 //line templates/delete.qtpl:17
func WriteDeleteAskHTML(qq422016 qtio422016.Writer, hyphaName string, isOld bool) { func WriteDeleteAskHTML(qq422016 qtio422016.Writer, hyphaName string, isOld bool) {
//line templates/http_delete.qtpl:17 //line templates/delete.qtpl:17
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/http_delete.qtpl:17 //line templates/delete.qtpl:17
StreamDeleteAskHTML(qw422016, hyphaName, isOld) StreamDeleteAskHTML(qw422016, hyphaName, isOld)
//line templates/http_delete.qtpl:17 //line templates/delete.qtpl:17
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line templates/http_delete.qtpl:17 //line templates/delete.qtpl:17
} }
//line templates/http_delete.qtpl:17 //line templates/delete.qtpl:17
func DeleteAskHTML(hyphaName string, isOld bool) string { func DeleteAskHTML(hyphaName string, isOld bool) string {
//line templates/http_delete.qtpl:17 //line templates/delete.qtpl:17
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line templates/http_delete.qtpl:17 //line templates/delete.qtpl:17
WriteDeleteAskHTML(qb422016, hyphaName, isOld) WriteDeleteAskHTML(qb422016, hyphaName, isOld)
//line templates/http_delete.qtpl:17 //line templates/delete.qtpl:17
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line templates/http_delete.qtpl:17 //line templates/delete.qtpl:17
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line templates/http_delete.qtpl:17 //line templates/delete.qtpl:17
return qs422016 return qs422016
//line templates/http_delete.qtpl:17 //line templates/delete.qtpl:17
} }
//line templates/http_delete.qtpl:19 //line templates/delete.qtpl:19
func streamcannotDeleteDueToNonExistence(qw422016 *qt422016.Writer, hyphaName string) { func streamcannotDeleteDueToNonExistence(qw422016 *qt422016.Writer, hyphaName string) {
//line templates/http_delete.qtpl:19 //line templates/delete.qtpl:19
qw422016.N().S(` qw422016.N().S(`
<section> <section>
<h1>Cannot delete `) <h1>Cannot delete `)
//line templates/http_delete.qtpl:21 //line templates/delete.qtpl:21
qw422016.E().S(hyphaName) qw422016.E().S(hyphaName)
//line templates/http_delete.qtpl:21 //line templates/delete.qtpl:21
qw422016.N().S(`</h1> qw422016.N().S(`</h1>
<p>This hypha does not exist.</p> <p>This hypha does not exist.</p>
<p><a href="/page/`) <p><a href="/page/`)
//line templates/http_delete.qtpl:23 //line templates/delete.qtpl:23
qw422016.E().S(hyphaName) qw422016.E().S(hyphaName)
//line templates/http_delete.qtpl:23 //line templates/delete.qtpl:23
qw422016.N().S(`">Go back</a></p> qw422016.N().S(`">Go back</a></p>
</section> </section>
`) `)
//line templates/http_delete.qtpl:25 //line templates/delete.qtpl:25
} }
//line templates/http_delete.qtpl:25 //line templates/delete.qtpl:25
func writecannotDeleteDueToNonExistence(qq422016 qtio422016.Writer, hyphaName string) { func writecannotDeleteDueToNonExistence(qq422016 qtio422016.Writer, hyphaName string) {
//line templates/http_delete.qtpl:25 //line templates/delete.qtpl:25
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/http_delete.qtpl:25 //line templates/delete.qtpl:25
streamcannotDeleteDueToNonExistence(qw422016, hyphaName) streamcannotDeleteDueToNonExistence(qw422016, hyphaName)
//line templates/http_delete.qtpl:25 //line templates/delete.qtpl:25
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line templates/http_delete.qtpl:25 //line templates/delete.qtpl:25
} }
//line templates/http_delete.qtpl:25 //line templates/delete.qtpl:25
func cannotDeleteDueToNonExistence(hyphaName string) string { func cannotDeleteDueToNonExistence(hyphaName string) string {
//line templates/http_delete.qtpl:25 //line templates/delete.qtpl:25
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line templates/http_delete.qtpl:25 //line templates/delete.qtpl:25
writecannotDeleteDueToNonExistence(qb422016, hyphaName) writecannotDeleteDueToNonExistence(qb422016, hyphaName)
//line templates/http_delete.qtpl:25 //line templates/delete.qtpl:25
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line templates/http_delete.qtpl:25 //line templates/delete.qtpl:25
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line templates/http_delete.qtpl:25 //line templates/delete.qtpl:25
return qs422016 return qs422016
//line templates/http_delete.qtpl:25 //line templates/delete.qtpl:25
} }