via

Simple pubsub server inspired by https://patchbay.pub/
git clone https://git.ce9e.org/via.git

commit
20f8b031e14eb84e562eb5f19646dafc79f5f30a
parent
09a6046d1514e957a5928d592e29f9d4ffb0a009
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-07-16 05:06
rename getPath to getStorePath

Diffstat

M via.go 8 ++++----

1 files changed, 4 insertions, 4 deletions


diff --git a/via.go b/via.go

@@ -77,7 +77,7 @@ func popChannel(key string, ch chan []byte) {
   77    77 	}
   78    78 }
   79    79 
   80    -1 func getPath(key string) string {
   -1    80 func getStorePath(key string) string {
   81    81 	hash := base64.URLEncoding.EncodeToString([]byte(key))
   82    82 	return path.Join(dir, hash)
   83    83 }
@@ -158,7 +158,7 @@ func getMsg(w http.ResponseWriter, r *http.Request) {
  158   158 }
  159   159 
  160   160 func putStore(w http.ResponseWriter, r *http.Request) {
  161    -1 	path := getPath(r.URL.Path)
   -1   161 	path := getStorePath(r.URL.Path)
  162   162 
  163   163 	content, err := ioutil.ReadAll(r.Body)
  164   164 	if err != nil {
@@ -176,7 +176,7 @@ func putStore(w http.ResponseWriter, r *http.Request) {
  176   176 }
  177   177 
  178   178 func getStore(w http.ResponseWriter, r *http.Request) {
  179    -1 	path := getPath(r.URL.Path)
   -1   179 	path := getStorePath(r.URL.Path)
  180   180 
  181   181 	content, err := ioutil.ReadFile(path)
  182   182 	if os.IsNotExist(err) {
@@ -192,7 +192,7 @@ func getStore(w http.ResponseWriter, r *http.Request) {
  192   192 }
  193   193 
  194   194 func deleteStore(w http.ResponseWriter, r *http.Request) {
  195    -1 	path := getPath(r.URL.Path)
   -1   195 	path := getStorePath(r.URL.Path)
  196   196 
  197   197 	err := os.Remove(path)
  198   198 	if os.IsNotExist(err) {