Browse Source

Rename 'skins' to 'apps'

Addresses https://github.com/solid/solid/issues/4
Dmitri Zagidulin 6 years ago
parent
commit
8542e7ac32
7 changed files with 32 additions and 32 deletions
  1. 4 4
      gold.conf-example
  2. 10 10
      server.go
  3. 1 1
      server/daemon.go
  4. 9 9
      server_config.go
  5. 2 2
      server_test.go
  6. 4 4
      system.go
  7. 2 2
      templates.go

+ 4 - 4
gold.conf-example

@@ -23,11 +23,11 @@
 
 	"ACLSuffix": ".acl",
 
-	"DataSkin":  "tabulator",
+	"DataApp":  "tabulator",
 
-	"DirSkin":   "http://linkeddata.github.io/warp/#list/",
+	"DirApp":   "http://linkeddata.github.io/warp/#list/",
 
-	"SignUpSkin": "https://solid.github.io/solid-signup/?domain=",
+	"SignUpApp": "https://solid.github.io/solid-signup/?domain=",
 
 	"DirIndex":  ["index.html", "index.htm"],
 
@@ -43,4 +43,4 @@
 		"SSL": true,
 		"Insecure": false
 	}
-}
+}

+ 10 - 10
server.go

@@ -126,9 +126,9 @@ func handleStatusText(status int, err error) string {
 	case 200:
 		return "HTTP 200 - OK"
 	case 401:
-		return Skins["401"]
+		return Apps["401"]
 	case 403:
-		return Skins["403"]
+		return Apps["403"]
 	case 404:
 		return "HTTP 404 - Not found\n\n" + err.Error()
 	case 500:
@@ -358,7 +358,7 @@ func (s *Server) handle(w http.ResponseWriter, req *httpRequest) (r *response) {
 		}
 
 		if !resource.Exists {
-			return r.respond(404, Skins["404"])
+			return r.respond(404, Apps["404"])
 		}
 
 		// First redirect to path + trailing slash if it's missing
@@ -373,10 +373,10 @@ func (s *Server) handle(w http.ResponseWriter, req *httpRequest) (r *response) {
 		// overwrite ACL Link header
 		w.Header().Set("Link", brack(resource.AclURI)+"; rel=\"acl\", "+brack(resource.MetaURI)+"; rel=\"meta\"")
 
-		// redirect to skin
+		// redirect to app
 		if s.Config.Vhosts && !resource.Exists && resource.Base == strings.TrimRight(req.BaseURI(), "/") && contentType == "text/html" && req.Method != "HEAD" {
 			w.Header().Set(HCType, contentType)
-			urlStr := s.Config.SignUpSkin + url.QueryEscape(resource.Obj.Scheme+"://"+resource.Obj.Host+"/"+SystemPrefix+"/accountStatus")
+			urlStr := s.Config.SignUpApp + url.QueryEscape(resource.Obj.Scheme+"://"+resource.Obj.Host+"/"+SystemPrefix+"/accountStatus")
 			http.Redirect(w, req.Request, urlStr, 303)
 			return
 		}
@@ -427,9 +427,9 @@ func (s *Server) handle(w http.ResponseWriter, req *httpRequest) (r *response) {
 						w.Header().Set("Link", brack(resource.MetaURI)+"; rel=\"meta\", "+brack(resource.AclURI)+"; rel=\"acl\"")
 						break
 					} else if req.Method != "HEAD" {
-						//TODO load file manager skin from local preference file
+						//TODO load file manager app from local preference file
 						w.Header().Set(HCType, contentType)
-						urlStr := s.Config.DirSkin + resource.Obj.Scheme + "/" + resource.Obj.Host + "/" + resource.Obj.Path + "?" + req.Request.URL.RawQuery
+						urlStr := s.Config.DirApp + resource.Obj.Scheme + "/" + resource.Obj.Host + "/" + resource.Obj.Path + "?" + req.Request.URL.RawQuery
 						s.debug.Println("Redirecting to", urlStr)
 						http.Redirect(w, req.Request, urlStr, 303)
 						return
@@ -596,12 +596,12 @@ func (s *Server) handle(w http.ResponseWriter, req *httpRequest) (r *response) {
 			status = 200
 
 			if req.Method == "GET" && strings.Contains(contentType, "text/html") {
-				// delete ETag to force load the skin
+				// delete ETag to force load the app
 				w.Header().Del("ETag")
 				w.Header().Set("Link", brack(resource.MetaURI)+"; rel=\"meta\", "+brack(resource.AclURI)+"; rel=\"acl\"")
 				if maybeRDF {
 					w.Header().Set(HCType, contentType)
-					return r.respond(200, Skins[s.Config.DataSkin])
+					return r.respond(200, Apps[s.Config.DataApp])
 				}
 				w.Header().Set(HCType, magicType)
 				w.WriteHeader(200)
@@ -1083,7 +1083,7 @@ func (s *Server) handle(w http.ResponseWriter, req *httpRequest) (r *response) {
 		err = os.Remove(resource.File)
 		if err != nil {
 			if os.IsNotExist(err) {
-				return r.respond(404, Skins["404"])
+				return r.respond(404, Apps["404"])
 			}
 			return r.respond(500, err)
 		}

+ 1 - 1
server/daemon.go

@@ -25,7 +25,7 @@ var (
 	cookieT = flag.Int64("cookieAge", 24, "lifetime for cookies (in hours)")
 	debug   = flag.Bool("debug", false, "output extra logging?")
 	root    = flag.String("root", ".", "path to file storage root")
-	skin    = flag.String("skin", "tabulator", "default view for HTML clients")
+	app    = flag.String("app", "tabulator", "default viewer app for HTML clients")
 	tlsCert = flag.String("tlsCertFile", "", "TLS certificate eg. cert.pem")
 	tlsKey  = flag.String("tlsKeyFile", "", "TLS certificate eg. key.pem")
 	vhosts  = flag.Bool("vhosts", false, "run in virtual hosts mode?")

+ 9 - 9
server_config.go

@@ -49,14 +49,14 @@ type ServerConfig struct {
 	// ACLSuffix sets the default suffix for ACL files (e.g. ,acl or .acl)
 	ACLSuffix string
 
-	// DataSkin sets the default skin for viewing RDF resources
-	DataSkin string
+	// DataApp sets the default app for viewing RDF resources
+	DataApp string
 
-	// DirSkin points to the skin/app for browsing the data space
-	DirSkin string
+	// DirApp points to the app for browsing the data space
+	DirApp string
 
-	// SignUpSkin points to the skin/app used for creating new accounts
-	SignUpSkin string
+	// SignUpApp points to the app used for creating new accounts
+	SignUpApp string
 
 	// DirIndex contains the default index file name
 	DirIndex []string
@@ -75,10 +75,10 @@ func NewServerConfig() *ServerConfig {
 		TokenAge:   5,
 		MetaSuffix: ".meta",
 		ACLSuffix:  ".acl",
-		DataSkin:   "tabulator",
+		DataApp:   "tabulator",
 		DirIndex:   []string{"index.html", "index.htm"},
-		DirSkin:    "http://linkeddata.github.io/warp/#list/",
-		SignUpSkin: "https://solid.github.io/solid-signup/?domain=",
+		DirApp:    "http://linkeddata.github.io/warp/#list/",
+		SignUpApp: "https://solid.github.io/solid-signup/?domain=",
 		DiskLimit:  100000000, // 100MB
 		DataRoot:   serverDefaultRoot(),
 	}

+ 2 - 2
server_test.go

@@ -277,7 +277,7 @@ func TestRedirectToSlashContainer(t *testing.T) {
 	assert.NotEmpty(t, string(body))
 }
 
-func TestRedirectToDirSkin(t *testing.T) {
+func TestRedirectToDirApp(t *testing.T) {
 	transport := http.Transport{}
 	transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
 
@@ -287,7 +287,7 @@ func TestRedirectToDirSkin(t *testing.T) {
 	response, err := transport.RoundTrip(request)
 	assert.NoError(t, err)
 	assert.Equal(t, 303, response.StatusCode)
-	assert.True(t, strings.HasPrefix(response.Header.Get("Location"), handler.Config.DirSkin))
+	assert.True(t, strings.HasPrefix(response.Header.Get("Location"), handler.Config.DirApp))
 }
 
 func TestLDPPUTContainer(t *testing.T) {

+ 4 - 4
system.go

@@ -69,8 +69,8 @@ func accountRecovery(w http.ResponseWriter, req *httpRequest, s *Server) SystemR
 	} else if len(req.FormValue("token")) > 0 {
 		return validateRecoveryToken(w, req, s)
 	}
-	// return default skin with form
-	return SystemReturn{Status: 200, Body: Skins["accountRecovery"]}
+	// return default app with form
+	return SystemReturn{Status: 200, Body: Apps["accountRecovery"]}
 }
 
 func sendRecoveryToken(w http.ResponseWriter, req *httpRequest, s *Server) SystemReturn {
@@ -146,7 +146,7 @@ func validateRecoveryToken(w http.ResponseWriter, req *httpRequest, s *Server) S
 			s.debug.Println("Error setting new cookie: " + err.Error())
 			return SystemReturn{Status: 500, Body: err.Error()}
 		}
-		return SystemReturn{Status: 200, Body: Skins["newCert"]}
+		return SystemReturn{Status: 200, Body: Apps["newCert"]}
 	}
 	return SystemReturn{Status: 499, Body: "Missing validity date for token."}
 }
@@ -392,7 +392,7 @@ func newCert(w http.ResponseWriter, req *httpRequest, s *Server) SystemReturn {
 
 		return SystemReturn{Status: 200, Body: body}
 	} else if strings.Contains(req.Header.Get("Accept"), "text/html") {
-		return SystemReturn{Status: 200, Body: Skins["newCert"]}
+		return SystemReturn{Status: 200, Body: Apps["newCert"]}
 	}
 	return SystemReturn{Status: 500, Body: "Your request could not be processed. Either no WebID or no SPKAC value was provided."}
 }

+ 2 - 2
templates.go

@@ -1,8 +1,8 @@
 package gold
 
 var (
-	// Skins contains a list of skins that get server instead of RDF
-	Skins = map[string]string{
+	// Apps contains a list of default apps that get server instead of RDF
+	Apps = map[string]string{
 		"tabulator": `<!DOCTYPE html>
 <html id="docHTML">
 <head>