Fix vite server (#2134)

#1799 broke it
This commit is contained in:
qwerty287 2023-08-07 17:03:26 +02:00 committed by GitHub
parent 67b7de5cc2
commit 4558f7c691
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -166,6 +166,9 @@ func parseIndex() []byte {
if err != nil { if err != nil {
log.Fatal().Err(err).Msg("can not find index.html") log.Fatal().Err(err).Msg("can not find index.html")
} }
data = bytes.ReplaceAll(data, []byte("/web-config.js"), []byte(server.Config.Server.RootPath+"/web-config.js"))
data = bytes.ReplaceAll(data, []byte("/assets/custom.css"), []byte(server.Config.Server.RootPath+"/assets/custom.css"))
data = bytes.ReplaceAll(data, []byte("/assets/custom.js"), []byte(server.Config.Server.RootPath+"/assets/custom.js"))
return data return data
} }

View file

@ -7,12 +7,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#65a30d" /> <meta name="theme-color" content="#65a30d" />
<title>Woodpecker</title> <title>Woodpecker</title>
<script type="" src="/BASE_PATH/web-config.js"></script> <script type="" src="/web-config.js"></script>
<link rel="stylesheet" href="/BASE_PATH/assets/custom.css" /> <link rel="stylesheet" href="/assets/custom.css" />
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<script type="module" src="/src/main.ts"></script> <script type="module" src="/src/main.ts"></script>
<script type="application/javascript" src="/BASE_PATH/assets/custom.js"></script> <script type="application/javascript" src="/assets/custom.js"></script>
</body> </body>
</html> </html>