Add environment variables to make it easy for anyone to host

This commit is contained in:
2025-02-28 11:50:53 -06:00
parent 69239287b2
commit c75f426065
4 changed files with 100 additions and 48 deletions

View File

@@ -18,7 +18,7 @@ function noSearchDefaultPageRender() {
<input
type="text"
class="url-input"
value="https://bang.gbrown.org?q=%s"
value="${import.meta.env.VITE_BANG_URL}?q=%s"
readonly
/>
<button class="copy-button">
@@ -41,7 +41,7 @@ function noSearchDefaultPageRender() {
</tr>
<tr>
<td><b>Engine URL:</b></td>
<td>https://bang.gbrown.org?q=%s</td>
<td>${import.meta.env.VITE_BANG_URL}?q=%s</td>
</tr>
<tr>
<td><b>Alias:</b></td>
@@ -113,7 +113,8 @@ function noSearchDefaultPageRender() {
});
}
const LS_DEFAULT_BANG = localStorage.getItem("default-bang") ?? "sg";
const envDefaultBang = import.meta.env.VITE_DEFAULT_BANG ?? "g";
const LS_DEFAULT_BANG = localStorage.getItem("default-bang") ?? envDefaultBang;
const defaultBang = bangs.find((b) => b.t === LS_DEFAULT_BANG);
function getBangredirectUrl() {