mirror of
https://github.com/thomiceli/opengist.git
synced 2026-06-23 04:10:18 +00:00
Fix CSS url for json embed url (#715)
Signed-off-by: Thomas Miceli <tho.miceli@gmail.com>
This commit is contained in:
@@ -98,8 +98,7 @@ func GistJson(ctx *context.Context) error {
|
||||
themeSep = "&"
|
||||
}
|
||||
jsUrl := jsBaseUrl + fileQuery
|
||||
|
||||
cssUrl, err := url.JoinPath(ctx.GetData("baseHttpUrl").(string), context.ManifestEntries["embed.css"].File)
|
||||
cssUrl, err := url.JoinPath(ctx.GetData("baseHttpUrl").(string), context.ManifestEntries["ts/embed.ts"].Css[0])
|
||||
if err != nil {
|
||||
return ctx.ErrorRes(500, "Error joining css url", err)
|
||||
}
|
||||
|
||||
@@ -10,19 +10,9 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/thomiceli/opengist/internal/db"
|
||||
"github.com/thomiceli/opengist/internal/web/context"
|
||||
webtest "github.com/thomiceli/opengist/internal/web/test"
|
||||
)
|
||||
|
||||
func setupManifestEntries() {
|
||||
context.ManifestEntries = map[string]context.Asset{
|
||||
"embed.css": {File: "assets/embed.css"},
|
||||
"ts/embed.ts": {Css: []string{"assets/embed.css"}},
|
||||
"ts/light.ts": {Css: []string{"assets/light.css"}},
|
||||
"ts/dark.ts": {Css: []string{"assets/dark.css"}},
|
||||
}
|
||||
}
|
||||
|
||||
func TestGistIndex(t *testing.T) {
|
||||
s := webtest.Setup(t)
|
||||
defer webtest.Teardown(t)
|
||||
@@ -141,8 +131,6 @@ func TestPreview(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGistJson(t *testing.T) {
|
||||
setupManifestEntries()
|
||||
|
||||
s := webtest.Setup(t)
|
||||
defer webtest.Teardown(t)
|
||||
|
||||
@@ -328,8 +316,6 @@ func TestGetGistCaseInsensitive(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGistJsSingleFile(t *testing.T) {
|
||||
setupManifestEntries()
|
||||
|
||||
s := webtest.Setup(t)
|
||||
defer webtest.Teardown(t)
|
||||
|
||||
@@ -393,8 +379,6 @@ func TestGistJsSingleFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGistJsonSingleFile(t *testing.T) {
|
||||
setupManifestEntries()
|
||||
|
||||
s := webtest.Setup(t)
|
||||
defer webtest.Teardown(t)
|
||||
|
||||
|
||||
@@ -216,6 +216,13 @@ func Setup(t *testing.T) *Server {
|
||||
config.SetupSecretKey()
|
||||
config.InitLog()
|
||||
|
||||
context.ManifestEntries = map[string]context.Asset{
|
||||
"embed.css": {File: "assets/embed.css"},
|
||||
"ts/embed.ts": {Css: []string{"assets/embed.css"}},
|
||||
"ts/light.ts": {Css: []string{"assets/light.css"}},
|
||||
"ts/dark.ts": {Css: []string{"assets/dark.css"}},
|
||||
}
|
||||
|
||||
tmpGitConfig := filepath.Join(tmpDir, "gitconfig")
|
||||
t.Setenv("GIT_CONFIG_GLOBAL", tmpGitConfig)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user