forked from obot-platform/obot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add static dir and agents dirs options, move ui to /users path
- Loading branch information
1 parent
44d177d
commit 1fbd7c8
Showing
22 changed files
with
212 additions
and
46 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
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 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,39 @@ | ||
package static | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
"os" | ||
"strings" | ||
) | ||
|
||
func Wrap(next http.Handler, dir string) (http.Handler, error) { | ||
mux := http.NewServeMux() | ||
mux.Handle("/", next) | ||
|
||
fs := http.FileServer(http.Dir(dir)) | ||
|
||
entries, err := os.ReadDir(dir) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to read directory: %w", err) | ||
} | ||
|
||
for _, entry := range entries { | ||
if entry.IsDir() { | ||
mux.Handle("GET /"+entry.Name()+"/", fs) | ||
continue | ||
} | ||
|
||
if strings.HasPrefix(entry.Name(), ".") { | ||
continue | ||
} | ||
|
||
mux.Handle("GET /"+entry.Name(), fs) | ||
|
||
if entry.Name() == "index.html" { | ||
mux.Handle("GET /{$}", fs) | ||
} | ||
} | ||
|
||
return mux, nil | ||
} |
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 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 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,13 +1,13 @@ | ||
export type AuthProvider = { | ||
configured: boolean | ||
icon?: string | ||
name: string | ||
namespace: string | ||
id: string | ||
} | ||
configured: boolean; | ||
icon?: string; | ||
name: string; | ||
namespace: string; | ||
id: string; | ||
}; | ||
|
||
export async function listAuthProviders(): Promise<AuthProvider[]> { | ||
const resp = await fetch('/api/auth-providers') | ||
const data = await resp.json() | ||
return data.items.filter((provider: AuthProvider) => provider.configured); | ||
const resp = await fetch('/api/auth-providers'); | ||
const data = await resp.json(); | ||
return data.items.filter((provider: AuthProvider) => provider.configured); | ||
} |
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
Oops, something went wrong.