Commit 4c4eb47d authored by Juergen Enge's avatar Juergen Enge
Browse files

neue syntax beschrieben

parent 32e4662b
Pipeline #14867 passed with stages
in 3 minutes and 35 seconds
......@@ -36,13 +36,16 @@ Token Subject: ```<signature>```
* viewer
Displays viewer which is iFrame embeddable
Displays viewer which is iFrame embeddable
Signature of Poster Image for Video/Audio-Player: `<signature>-poster`
* resize
Default command for image retrieval. Needs obligatory size parameter.
http://localhost:88/memo/sig-5005/resize/size800x200/stretch/formatJPEG
http://localhost:88/memo/sig-5005/resize/size800x200/stretch/formatJPEG/fallbacksig-5006
* iiif
sends parameters directly to iiif image server
......@@ -65,16 +68,18 @@ https://tools.ietf.org/html/rfc2616#page-14
data-Base = TEXT
signature = TEXT
media-Command = master | resize | iiif | viewer
viewer = "viewer"
master = "master"
resize = "resize" "/" size ["/" (stretch | crop)] ["/" flip] ["/" format]
viewer = "viewer" ["/" fallback]
master = "master" ["/" fallback]
resize = "resize" "/" size ["/" (stretch | crop)] ["/" flip] ["/" format] ["/" fallback]
manifest = "manifest" ["/" fallback]
size = "size" width "x" height
width = 1*DIGIT
height = 1*DIGIT
stretch = "stretch"
crop = "crop"
flip = "flip"
format = "format" ("PNG" ¦ "JPEG")
format = "format" ("PNG" | "JPEG")
fallback = "fallback" signature
iiif = "iiif" "/" (iiif-ImageRequest | iiif-InformationRequest)
iiif-InformationRequest = "info.json"
iiif-ImageRequest = iiifregion "/" iiifsize "/" iiifrotation "/" iiifquality "." iiifformat
......
......@@ -9,7 +9,7 @@ staticprefix = "/static/"
urlprefix = "/memo/" # prefix for accessing signature based content
# http://localhost:81/command/clearcache?auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjbWQ6Y2xlYXJjYWNoZSIsImV4cCI6MTgxNjIzOTAyMn0.M_Y6R4yMAFEyo534-SXAffPwdHv929WcuSgQUcjiz10
cmdprefix = "/command/"
jwtkey = "<swordfish>"
jwtkey = "swordfish"
jwtalg = ["HS256", "HS384", "HS512"] # "hs256" "hs384" "hs512" "es256" "es384" "es512" "ps256" "ps384" "ps512"
resolverCacheSize = 1000
errorTemplate = "C:/daten/go/dev/memobase/streaming-server/web/template/error.gohtml" # error message for memoHandler
......@@ -39,10 +39,49 @@ folder = "C:/daten/go/src/gitlab.switch.ch/memoriav/memobase-2020/services/strea
[resolverDBMySQL]
#if dsn is empty, the static resolver will be used
#[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]
dsn = "test:[swordfish]@tcp(localhost:3306)/test"
dsn = "test:<swordfish>@tcp(localhost:3306)/test"
#dsn = "urlchecker:<swordfish>@tcp(localhost:4306)/medienserver"
#dsn = ""
# should be smaller than server connection timeout to allow controlled reconnect
connMaxTimeout = "4h"
# query has to return the fields uri, access and protocol. One parameter
#query = "SELECT uri, access, proto AS protocol, `status` FROM mediaserver.entities WHERE sig = ?"
query = "SELECT `uri`, `access`, `proto` AS protocol, `status`, `type`, `mimetype`, `width`, `height`, `duration` FROM test.entities_metadata WHERE sig = ?"
schema = "test"
[signatures]
[signatures.sig-01]
type = "file"
uri = "file:///C:/daten/Persoenlich/bilder/MobilePhotos/16-09-03 13-41-58 0634.mp4"
access = "public"
# http://localhost:81/memo/sig-01
[signatures.sig-02]
type = "redirect"
uri = "https://ba14ns21403.fhnw.ch/video/open/performance/2002_B_B_Yours_Sincerly.mov.mp4"
access = "public"
# http://localhost:81/memo/sig-02
[signatures.sig-03]
type = "file"
uri = "file:///C:/daten/Persoenlich/bilder/MobilePhotos/16-09-03 13-41-58 0634.mp4"
access = "closed"
# http://localhost:81/memo/sig-03?auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzaWctMDMiLCJleHAiOjE4MTYyMzkwMjJ9.bHrv5_5-dtI9EvxeoxZTw2DWi7HKNpFZ-S8Vb_F2Ps4
[signatures.sig-04]
type = "proxy"
uri = "https://ba14ns21403.fhnw.ch/video/open/performance/2002_B_B_Yours_Sincerly.mov.mp4"
access = "public"
# http://localhost:81/memo/sig-04
[signatures.sig-05]
type = "file"
uri = "file:///C:/Users/juergen.enge/Downloads/cantaloupe-4.1.5/data/milkyway.jpg"
access = "public"
# http://localhost:81/memo/sig-05/iiif/view
[signatures.sig-06]
type = "file"
uri = "file:///C:/Users/juergen.enge/Downloads/cantaloupe-4.1.5/data/milkyway.jpg"
access = "closed"
# http://localhost:81/memo/sig-06/iiif/view?auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzaWctMDYiLCJleHAiOjE4MTYyMzkwMjJ9.jBTTT5cGKXoP7zJO1CXviAxJm2j49fxfZHH7BEi9lzI
......@@ -11,6 +11,7 @@
package memostream
import (
"expvar"
"fmt"
"github.com/gorilla/mux"
"net/http"
......@@ -37,6 +38,27 @@ func (ms *memoServer) commandHandler(w http.ResponseWriter, req *http.Request) {
ms.ClearCache()
ms.log.Info("cache cleared")
w.Write([]byte("ok"))
case "metrics":
w.Header().Set("Content-Type", "application/json; charset=utf-8")
first := true
report := func(key string, value interface{}) {
if !first {
fmt.Fprintf(w, ",\n")
}
first = false
if str, ok := value.(string); ok {
fmt.Fprintf(w, "%q: %q", key, str)
} else {
fmt.Fprintf(w, "%q: %v", key, value)
}
}
fmt.Fprintf(w, "{\n")
expvar.Do(func(kv expvar.KeyValue) {
report(kv.Key, kv.Value)
})
fmt.Fprintf(w, "\n}\n")
default:
errStr := fmt.Sprintf("unknown command: %ms", cmd)
ms.log.Error(errStr)
......@@ -44,5 +66,3 @@ func (ms *memoServer) commandHandler(w http.ResponseWriter, req *http.Request) {
return
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment