-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- serve UI - UI runtime configuration - defaults set to self hosting values
- Loading branch information
Showing
32 changed files
with
176 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
release/ | ||
ui/ | ||
node_modules | ||
docs/ | ||
landing/ | ||
.env | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,17 @@ | ||
package api | ||
|
||
import ( | ||
"encoding/json" | ||
"net/http" | ||
|
||
"github.com/ncarlier/readflow/pkg/config" | ||
"github.com/ncarlier/readflow/pkg/service" | ||
"github.com/ncarlier/readflow/pkg/version" | ||
"github.com/rs/zerolog/log" | ||
) | ||
|
||
// Info API informations model structure. | ||
type Info struct { | ||
Version string `json:"version"` | ||
Authority string `json:"authority"` | ||
VAPID string `json:"vapid"` | ||
} | ||
|
||
// index is the handler to show API details. | ||
func index(conf *config.Config) http.Handler { | ||
v := Info{ | ||
Version: version.Version, | ||
Authority: conf.Global.AuthN, | ||
VAPID: service.Lookup().GetProperties().VAPIDPublicKey, | ||
if conf.Global.UILocation != "" { | ||
log.Debug().Str("location", conf.Global.UILocation).Msg("serving UI") | ||
return http.FileServer(http.Dir(conf.Global.UILocation)) | ||
} | ||
|
||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
if r.URL.Path != "/" { | ||
http.NotFound(w, r) | ||
return | ||
} | ||
data, err := json.Marshal(v) | ||
if err != nil { | ||
http.Error(w, err.Error(), http.StatusInternalServerError) | ||
return | ||
} | ||
w.Header().Set("Content-Type", "application/json") | ||
w.Write(data) | ||
}) | ||
return http.RedirectHandler("/info", http.StatusSeeOther) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package api | ||
|
||
import ( | ||
"encoding/json" | ||
"net/http" | ||
|
||
"github.com/ncarlier/readflow/pkg/config" | ||
"github.com/ncarlier/readflow/pkg/service" | ||
"github.com/ncarlier/readflow/pkg/version" | ||
) | ||
|
||
// Info API informations model structure. | ||
type Info struct { | ||
Version string `json:"version"` | ||
Authority string `json:"authority"` | ||
VAPID string `json:"vapid"` | ||
} | ||
|
||
// info is the handler to show API details. | ||
func info(conf *config.Config) http.Handler { | ||
v := Info{ | ||
Version: version.Version, | ||
Authority: conf.Global.AuthN, | ||
VAPID: service.Lookup().GetProperties().VAPIDPublicKey, | ||
} | ||
|
||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
data, err := json.Marshal(v) | ||
if err != nil { | ||
http.Error(w, err.Error(), http.StatusInternalServerError) | ||
return | ||
} | ||
w.Header().Set("Content-Type", "application/json") | ||
w.Write(data) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.