pkg/server{,init}: delete more remnants of long-deleted setup wizard (take 2)

This is a redo of the previously-reverted b663eacb06 but with
tests fixed this time. (I accidentally ran them earlier with
--exec=true from an earlier refactor.)

Signed-off-by: Brad Fitzpatrick <brad@danga.com>
This commit is contained in:
Brad Fitzpatrick 2024-01-14 16:40:37 -08:00
parent 6746b8cd2b
commit 6a119e44a6
42 changed files with 39 additions and 233 deletions

View File

@ -1,70 +0,0 @@
/*
Copyright 2012 The Perkeep Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package server
import (
"fmt"
"net/http"
"go4.org/jsonconfig"
"perkeep.org/pkg/auth"
"perkeep.org/pkg/blobserver"
)
// SetupHandler handles serving the wizard setup page.
type SetupHandler struct {
config jsonconfig.Obj
}
func init() {
blobserver.RegisterHandlerConstructor("setup", newSetupFromConfig)
}
func newSetupFromConfig(ld blobserver.Loader, conf jsonconfig.Obj) (h http.Handler, err error) {
wizard := &SetupHandler{config: conf}
return wizard, nil
}
func (sh *SetupHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
if !auth.IsLocalhost(req) {
fmt.Fprintf(rw,
"<html><body>Setup only allowed from localhost"+
"<p><a href='/'>Back</a></p>"+
"</body></html>\n")
return
}
http.Redirect(rw, req, "https://perkeep.org/doc/server-config", http.StatusMovedPermanently)
return
// TODO: this file and the code in wizard-html.go is outdated. Anyone interested enough
// can take care of updating it as something nicer which would fit better with the
// react UI. But in the meantime we don't link to it anymore.
// if req.Method == "POST" {
// err := req.ParseMultipartForm(10e6)
// if err != nil {
// httputil.ServeError(rw, req, err)
// return
// }
// if len(req.Form) > 0 {
// handleSetupChange(rw, req)
// }
// return
// }
// sendWizard(rw, req, false)
}

View File

@ -849,7 +849,6 @@ func (b *lowBuilder) genLowLevelPrefixes() error {
})
}
b.addPrefix("/", "root", rootArgs)
b.addPrefix("/setup/", "setup", nil)
b.addPrefix("/status/", "status", nil)
b.addPrefix("/help/", "help", nil)

View File

@ -367,12 +367,6 @@ func TestInstallHandlers(t *testing.T) {
authWrapped: true,
},
{
prefix: "/setup/",
handlerType: reflect.TypeOf(&server.SetupHandler{}),
prefixWrapped: true,
},
{
prefix: "/bs/camli/",
handlerType: reflect.TypeOf(http.HandlerFunc(nil)),

View File

@ -78,9 +78,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -117,4 +114,4 @@
}
}
}
}
}

View File

@ -77,9 +77,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -120,4 +117,4 @@
}
}
}
}
}

View File

@ -109,9 +109,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -158,4 +155,4 @@
}
}
}
}
}

View File

@ -103,9 +103,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -142,4 +139,4 @@
}
}
}
}
}

View File

@ -109,9 +109,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -158,4 +155,4 @@
}
}
}
}
}

View File

@ -93,9 +93,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -136,4 +133,4 @@
}
}
}
}
}

View File

@ -76,9 +76,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -119,4 +116,4 @@
}
}
}
}
}

View File

@ -84,9 +84,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -127,4 +124,4 @@
}
}
}
}
}

View File

@ -80,9 +80,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -123,4 +120,4 @@
}
}
}
}
}

View File

@ -80,9 +80,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -119,4 +116,4 @@
}
}
}
}
}

View File

@ -80,9 +80,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -119,4 +116,4 @@
}
}
}
}
}

View File

@ -83,9 +83,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -132,4 +129,4 @@
}
}
}
}
}

View File

@ -80,9 +80,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -119,4 +116,4 @@
}
}
}
}
}

View File

@ -80,9 +80,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -119,4 +116,4 @@
}
}
}
}
}

View File

@ -76,9 +76,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -119,4 +116,4 @@
}
}
}
}
}

View File

@ -80,9 +80,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -123,4 +120,4 @@
}
}
}
}
}

View File

@ -29,9 +29,6 @@
"/help/": {
"handler": "help"
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -51,4 +48,4 @@
"handler": "status"
}
}
}
}

View File

@ -76,9 +76,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -119,4 +116,4 @@
}
}
}
}
}

View File

@ -76,9 +76,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -119,4 +116,4 @@
}
}
}
}
}

View File

@ -76,9 +76,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -182,4 +179,4 @@
}
}
}
}
}

View File

@ -75,9 +75,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -117,4 +114,4 @@
}
}
}
}
}

View File

@ -70,9 +70,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -108,4 +105,4 @@
}
}
}
}
}

View File

@ -79,9 +79,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -125,4 +122,4 @@
}
}
}
}
}

View File

@ -103,9 +103,6 @@
"serverListen": "localhost:3179"
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -146,4 +143,4 @@
}
}
}
}
}

View File

@ -83,9 +83,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -132,4 +129,4 @@
}
}
}
}
}

View File

@ -83,9 +83,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -132,4 +129,4 @@
}
}
}
}
}

View File

@ -47,9 +47,6 @@
"/help/": {
"handler": "help"
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -69,4 +66,4 @@
"handler": "status"
}
}
}
}

View File

@ -92,9 +92,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -257,4 +254,4 @@
}
}
}
}
}

View File

@ -93,9 +93,6 @@
"serverListen": ":3179"
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -136,4 +133,4 @@
}
}
}
}
}

View File

@ -78,9 +78,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -117,4 +114,4 @@
}
}
}
}
}

View File

@ -77,9 +77,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -116,4 +113,4 @@
}
}
}
}
}

View File

@ -80,9 +80,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -129,4 +126,4 @@
}
}
}
}
}

View File

@ -77,9 +77,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -116,4 +113,4 @@
}
}
}
}
}

View File

@ -75,9 +75,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -118,4 +115,4 @@
}
}
}
}
}

View File

@ -83,9 +83,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -132,4 +129,4 @@
}
}
}
}
}

View File

@ -92,9 +92,6 @@
"serverListen": "1.2.3.4:443"
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -135,4 +132,4 @@
}
}
}
}
}

View File

@ -89,9 +89,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -132,4 +129,4 @@
}
}
}
}
}

View File

@ -91,9 +91,6 @@
"serverListen": "localhost:3179"
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -134,4 +131,4 @@
}
}
}
}
}

View File

@ -75,9 +75,6 @@
"slurpToMemory": true
}
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
@ -138,4 +135,4 @@
}
}
}
}
}