mirror of
https://github.com/1f349/tulip.git
synced 2024-12-23 00:34:07 +00:00
Add dark theme
This commit is contained in:
parent
f00d1c4a51
commit
56ff556928
@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>{{.ServiceName}}</title>
|
<title>{{.ServiceName}}</title>
|
||||||
|
<link rel="stylesheet" href="/theme/dark.css" media="screen and (prefers-color-scheme: dark)">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>{{.ServiceName}}</title>
|
<title>{{.ServiceName}}</title>
|
||||||
|
<link rel="stylesheet" href="/theme/dark.css" media="screen and (prefers-color-scheme: dark)">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>{{.ServiceName}}</title>
|
<title>{{.ServiceName}}</title>
|
||||||
|
<link rel="stylesheet" href="/theme/dark.css" media="screen and (prefers-color-scheme: dark)">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>{{.ServiceName}}</title>
|
<title>{{.ServiceName}}</title>
|
||||||
|
<link rel="stylesheet" href="/theme/dark.css" media="screen and (prefers-color-scheme: dark)">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>{{.ServiceName}}</title>
|
<title>{{.ServiceName}}</title>
|
||||||
|
<link rel="stylesheet" href="/theme/dark.css" media="screen and (prefers-color-scheme: dark)">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>{{.ServiceName}}</title>
|
<title>{{.ServiceName}}</title>
|
||||||
|
<link rel="stylesheet" href="/theme/dark.css" media="screen and (prefers-color-scheme: dark)">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>{{.ServiceName}}</title>
|
<title>{{.ServiceName}}</title>
|
||||||
|
<link rel="stylesheet" href="/theme/dark.css" media="screen and (prefers-color-scheme: dark)">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>{{.ServiceName}}</title>
|
<title>{{.ServiceName}}</title>
|
||||||
|
<link rel="stylesheet" href="/theme/dark.css" media="screen and (prefers-color-scheme: dark)">
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener("load", function () {
|
window.addEventListener("load", function () {
|
||||||
selectText("app-secret");
|
selectText("app-secret");
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>{{.ServiceName}}</title>
|
<title>{{.ServiceName}}</title>
|
||||||
|
<link rel="stylesheet" href="/theme/dark.css" media="screen and (prefers-color-scheme: dark)">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>{{.ServiceName}}</title>
|
<title>{{.ServiceName}}</title>
|
||||||
|
<link rel="stylesheet" href="/theme/dark.css" media="screen and (prefers-color-scheme: dark)">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>{{.ServiceName}}</title>
|
<title>{{.ServiceName}}</title>
|
||||||
|
<link rel="stylesheet" href="/theme/dark.css" media="screen and (prefers-color-scheme: dark)">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>{{.ServiceName}}</title>
|
<title>{{.ServiceName}}</title>
|
||||||
|
<link rel="stylesheet" href="/theme/dark.css" media="screen and (prefers-color-scheme: dark)">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
package server
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"github.com/go-oauth2/oauth2/v4"
|
|
||||||
)
|
|
||||||
|
|
||||||
var _ oauth2.TokenStore = &TestingStruct{}
|
|
||||||
|
|
||||||
type TestingStruct struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t TestingStruct) Create(ctx context.Context, info oauth2.TokenInfo) error {
|
|
||||||
fmt.Println(info.GetAccessExpiresIn())
|
|
||||||
fmt.Println(info.GetRefreshExpiresIn())
|
|
||||||
return errors.New("error")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t TestingStruct) RemoveByCode(ctx context.Context, code string) error {
|
|
||||||
//TODO implement me
|
|
||||||
panic("implement me")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t TestingStruct) RemoveByAccess(ctx context.Context, access string) error {
|
|
||||||
//TODO implement me
|
|
||||||
panic("implement me")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t TestingStruct) RemoveByRefresh(ctx context.Context, refresh string) error {
|
|
||||||
//TODO implement me
|
|
||||||
panic("implement me")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t TestingStruct) GetByCode(ctx context.Context, code string) (oauth2.TokenInfo, error) {
|
|
||||||
//TODO implement me
|
|
||||||
panic("implement me")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t TestingStruct) GetByAccess(ctx context.Context, access string) (oauth2.TokenInfo, error) {
|
|
||||||
//TODO implement me
|
|
||||||
panic("implement me")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t TestingStruct) GetByRefresh(ctx context.Context, refresh string) (oauth2.TokenInfo, error) {
|
|
||||||
//TODO implement me
|
|
||||||
panic("implement me")
|
|
||||||
}
|
|
@ -1,6 +1,7 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"crypto/subtle"
|
"crypto/subtle"
|
||||||
_ "embed"
|
_ "embed"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -10,6 +11,7 @@ import (
|
|||||||
"github.com/1f349/tulip/database"
|
"github.com/1f349/tulip/database"
|
||||||
"github.com/1f349/tulip/openid"
|
"github.com/1f349/tulip/openid"
|
||||||
scope2 "github.com/1f349/tulip/scope"
|
scope2 "github.com/1f349/tulip/scope"
|
||||||
|
"github.com/1f349/tulip/theme"
|
||||||
"github.com/go-oauth2/oauth2/v4/errors"
|
"github.com/go-oauth2/oauth2/v4/errors"
|
||||||
"github.com/go-oauth2/oauth2/v4/generates"
|
"github.com/go-oauth2/oauth2/v4/generates"
|
||||||
"github.com/go-oauth2/oauth2/v4/manage"
|
"github.com/go-oauth2/oauth2/v4/manage"
|
||||||
@ -153,6 +155,11 @@ func NewHttpServer(conf Conf, db *database.DB, privKey []byte) *http.Server {
|
|||||||
http.Error(rw, "Logout failed", http.StatusInternalServerError)
|
http.Error(rw, "Logout failed", http.StatusInternalServerError)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
// theme styles
|
||||||
|
r.GET("/theme/dark.css", func(rw http.ResponseWriter, req *http.Request, params httprouter.Params) {
|
||||||
|
http.ServeContent(rw, req, "dark.css", time.Now(), bytes.NewReader(theme.DarkThemeCss))
|
||||||
|
})
|
||||||
|
|
||||||
// login steps
|
// login steps
|
||||||
r.GET("/login", OptionalAuthentication(false, hs.LoginGet))
|
r.GET("/login", OptionalAuthentication(false, hs.LoginGet))
|
||||||
r.POST("/login", OptionalAuthentication(false, hs.LoginPost))
|
r.POST("/login", OptionalAuthentication(false, hs.LoginPost))
|
||||||
|
4
theme/dark.css
Normal file
4
theme/dark.css
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
html, body {
|
||||||
|
background-color: #242424;
|
||||||
|
color: #eeeeee;
|
||||||
|
}
|
6
theme/theme.go
Normal file
6
theme/theme.go
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package theme
|
||||||
|
|
||||||
|
import _ "embed"
|
||||||
|
|
||||||
|
//go:embed dark.css
|
||||||
|
var DarkThemeCss []byte
|
Loading…
Reference in New Issue
Block a user