merge
This commit is contained in:
commit
f3949b1b59
23 changed files with 586 additions and 969 deletions
29
main.go
29
main.go
|
|
@ -5,24 +5,15 @@ import (
|
|||
log "github.com/sirupsen/logrus"
|
||||
"net/http"
|
||||
"time"
|
||||
"github.com/boltcard/boltcard/db"
|
||||
"github.com/boltcard/boltcard/lnurlw"
|
||||
"github.com/boltcard/boltcard/lnurlp"
|
||||
)
|
||||
|
||||
func write_error(w http.ResponseWriter) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
jsonData := []byte(`{"status":"ERROR","reason":"bad request"}`)
|
||||
w.Write(jsonData)
|
||||
}
|
||||
|
||||
func write_error_message(w http.ResponseWriter, message string) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
jsonData := []byte(`{"status":"ERROR","reason":"` + message + `"}`)
|
||||
w.Write(jsonData)
|
||||
}
|
||||
var router = mux.NewRouter()
|
||||
|
||||
func main() {
|
||||
log_level := db_get_setting("LOG_LEVEL")
|
||||
log_level := db.Get_setting("LOG_LEVEL")
|
||||
|
||||
switch log_level {
|
||||
case "DEBUG":
|
||||
|
|
@ -49,11 +40,11 @@ func main() {
|
|||
// createboltcard
|
||||
external_router.Path("/new").Methods("GET").HandlerFunc(new_card_request)
|
||||
// lnurlw for pos
|
||||
external_router.Path("/ln").Methods("GET").HandlerFunc(lnurlw_response)
|
||||
external_router.Path("/cb").Methods("GET").HandlerFunc(lnurlw_callback)
|
||||
external_router.Path("/ln").Methods("GET").HandlerFunc(lnurlw.Response)
|
||||
external_router.Path("/cb").Methods("GET").HandlerFunc(lnurlw.Callback)
|
||||
// lnurlp for lightning address
|
||||
external_router.Path("/.well-known/lnurlp/{name}").Methods("GET").HandlerFunc(lnurlp_response)
|
||||
external_router.Path("/lnurlp/{name}").Methods("GET").HandlerFunc(lnurlp_callback)
|
||||
external_router.Path("/.well-known/lnurlp/{name}").Methods("GET").HandlerFunc(lnurlp.Response)
|
||||
external_router.Path("/lnurlp/{name}").Methods("GET").HandlerFunc(lnurlp.Callback)
|
||||
|
||||
// internal API
|
||||
// this has no authentication and is not to be exposed publicly
|
||||
|
|
@ -63,7 +54,7 @@ func main() {
|
|||
internal_router.Path("/createboltcard").Methods("GET").HandlerFunc(createboltcard)
|
||||
internal_router.Path("/wipeboltcard").Methods("GET").HandlerFunc(wipeboltcard)
|
||||
|
||||
port := db_get_setting("HOST_PORT")
|
||||
port := db.Get_setting("HOST_PORT")
|
||||
if port == "" {
|
||||
port = "9000"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue