mirror of
https://github.com/Forceu/Gokapi.git
synced 2026-05-12 09:29:50 -05:00
Changed /api endpoint to /apiKeys in order to avoid confusion with /api/
This commit is contained in:
+6
-5
@@ -124,15 +124,16 @@ All values that are described in :ref:`cloudstorage` can be passed as environmen
|
||||
External Authentication
|
||||
********************************
|
||||
|
||||
In order to use external authentication (eg. services like Authelia or Authentik), set the environment variable ``GOKAPI_DISABLE_LOGIN`` to ``true`` on the first start. *Warning:* This will diasable authentication for the admin menu, which can be dangerous if not set up correctly!
|
||||
In order to use external authentication (eg. services like Authelia or Authentik), set the environment variable ``GOKAPI_DISABLE_LOGIN`` to ``true`` on the first start. **Warning:** This will diasable authentication for the admin menu, which can be dangerous if not set up correctly!
|
||||
|
||||
**Refer to the documention of your reverse proxy on how to protect the following URLs:**
|
||||
|
||||
Refer to the documention of your reverse proxy on how to protect the following URLs:
|
||||
* ``/admin``
|
||||
* ``/apiNew``
|
||||
* ``/apiDelete``
|
||||
* ``/apiKeys``
|
||||
* ``/apiNew``
|
||||
* ``/delete``
|
||||
* ``/upload``
|
||||
* ``/api`` (``/api/`` however does not need to be protected)
|
||||
|
||||
.. _api:
|
||||
|
||||
@@ -140,7 +141,7 @@ Refer to the documention of your reverse proxy on how to protect the following U
|
||||
API
|
||||
********************************
|
||||
|
||||
Gokapi offers an API that can be reached at ``http(s)://your.gokapi.url/api``. You can find the current documentation with an overview of all API functions and examples at ``http(s)://your.gokapi.url/apidocumentation/``.
|
||||
Gokapi offers an API that can be reached at ``http(s)://your.gokapi.url/api/``. You can find the current documentation with an overview of all API functions and examples at ``http(s)://your.gokapi.url/apidocumentation/``.
|
||||
|
||||
|
||||
Interacting with the API
|
||||
|
||||
@@ -85,7 +85,7 @@ func Start() {
|
||||
http.HandleFunc("/downloadFile", downloadFile)
|
||||
http.HandleFunc("/forgotpw", forgotPassword)
|
||||
http.HandleFunc("/api/", processApi)
|
||||
http.HandleFunc("/api", showApiAdmin)
|
||||
http.HandleFunc("/apiKeys", showApiAdmin)
|
||||
http.HandleFunc("/apiNew", newApiKey)
|
||||
http.HandleFunc("/apiDelete", deleteApiKey)
|
||||
fmt.Println("Binding webserver to " + webserverPort)
|
||||
@@ -186,7 +186,7 @@ func newApiKey(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
api.NewKey()
|
||||
redirect(w, "api")
|
||||
redirect(w, "apiKeys")
|
||||
}
|
||||
|
||||
// Handling of /apiDelete
|
||||
@@ -199,7 +199,7 @@ func deleteApiKey(w http.ResponseWriter, r *http.Request) {
|
||||
if ok {
|
||||
api.DeleteKey(keys[0])
|
||||
}
|
||||
redirect(w, "api")
|
||||
redirect(w, "apiKeys")
|
||||
}
|
||||
|
||||
// Handling of /api/
|
||||
|
||||
@@ -426,7 +426,7 @@ func TestDeleteFile(t *testing.T) {
|
||||
func TestApiPageAuthorized(t *testing.T) {
|
||||
t.Parallel()
|
||||
test.HttpPageResult(t, test.HttpTestConfig{
|
||||
Url: "http://127.0.0.1:53843/api",
|
||||
Url: "http://127.0.0.1:53843/apiKeys",
|
||||
IsHtml: true,
|
||||
RequiredContent: []string{"Click on the API key name to give it a new name."},
|
||||
Cookies: []test.Cookie{{
|
||||
@@ -438,7 +438,7 @@ func TestApiPageAuthorized(t *testing.T) {
|
||||
func TestApiPageNotAuthorized(t *testing.T) {
|
||||
t.Parallel()
|
||||
test.HttpPageResult(t, test.HttpTestConfig{
|
||||
Url: "http://127.0.0.1:53843/api",
|
||||
Url: "http://127.0.0.1:53843/apiKeys",
|
||||
IsHtml: true,
|
||||
RequiredContent: []string{"URL=./login"},
|
||||
ExcludedContent: []string{"Click on the API key name to give it a new name."},
|
||||
@@ -457,7 +457,7 @@ func TestNewApiKey(t *testing.T) {
|
||||
test.HttpPageResult(t, test.HttpTestConfig{
|
||||
Url: "http://127.0.0.1:53843/apiNew",
|
||||
IsHtml: true,
|
||||
RequiredContent: []string{"URL=./api"},
|
||||
RequiredContent: []string{"URL=./apiKeys"},
|
||||
ExcludedContent: []string{"URL=./login"},
|
||||
Cookies: []test.Cookie{{
|
||||
Name: "session_token",
|
||||
@@ -476,7 +476,7 @@ func TestNewApiKey(t *testing.T) {
|
||||
Url: "http://127.0.0.1:53843/apiNew",
|
||||
IsHtml: true,
|
||||
RequiredContent: []string{"URL=./login"},
|
||||
ExcludedContent: []string{"URL=./api"},
|
||||
ExcludedContent: []string{"URL=./apiKeys"},
|
||||
Cookies: []test.Cookie{{
|
||||
Name: "session_token",
|
||||
Value: "invalid",
|
||||
@@ -498,7 +498,7 @@ func TestDeleteApiKey(t *testing.T) {
|
||||
Url: "http://127.0.0.1:53843/apiDelete?id=jiREglQJW0bOqJakfjdVfe8T1EM8n8",
|
||||
IsHtml: true,
|
||||
RequiredContent: []string{"URL=./login"},
|
||||
ExcludedContent: []string{"URL=./api"},
|
||||
ExcludedContent: []string{"URL=./apiKeys"},
|
||||
Cookies: []test.Cookie{{
|
||||
Name: "session_token",
|
||||
Value: "invalid",
|
||||
@@ -515,7 +515,7 @@ func TestDeleteApiKey(t *testing.T) {
|
||||
test.HttpPageResult(t, test.HttpTestConfig{
|
||||
Url: "http://127.0.0.1:53843/apiDelete?id=jiREglQJW0bOqJakfjdVfe8T1EM8n8",
|
||||
IsHtml: true,
|
||||
RequiredContent: []string{"URL=./api"},
|
||||
RequiredContent: []string{"URL=./apiKeys"},
|
||||
ExcludedContent: []string{"URL=./login"},
|
||||
Cookies: []test.Cookie{{
|
||||
Name: "session_token",
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<h1>{{template "app_name"}}</h1>
|
||||
<nav class="nav nav-masthead justify-content-center">
|
||||
<a class="nav-link {{ if .IsMainView }}active{{ end }}" href="./admin">Upload</a>
|
||||
<a class="nav-link {{ if not .IsMainView }}active{{ end }}" href="./api">API</a>
|
||||
<a class="nav-link {{ if not .IsMainView }}active{{ end }}" href="./apiKeys">API</a>
|
||||
{{ if not .IsLoginDisabled }}<a class="nav-link" href="./logout">Logout</a>{{ end }}
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user