Skip to content

Commit f4aa1fc

Browse files
committed
Start local assets support
1 parent 06e423a commit f4aa1fc

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const config: Config = {
44
// Server Configuration
55
server: {
66
port: 8080, // The port on which Interstellar runs (Default: 8080)
7-
assets: "github", // Assets Source. Use 'local' for storing assets locally.
7+
assets: "external", // Assets Source. Use 'local' for storing assets locally.
88
},
99

1010
// Authentication Configuration (Optional)

src/lib/assets.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import Cookies from "js-cookie";
2+
import INConfig from "config.ts";
23

3-
export const ASSET_URL =
4-
"https://raw.githubusercontent.com/UseInterstellar/Interstellar-Assets/main";
4+
export const ASSET_URL = INConfig.server && INConfig.server.assets === "external"
5+
? "https://raw.githubusercontent.com/UseInterstellar/Interstellar-Assets/main"
6+
: "/assets";
57

68
export type Asset = {
79
name: string;
@@ -31,6 +33,7 @@ export function addAsset(name: string, link: string, type: string) {
3133

3234
if (typeof window !== "undefined") {
3335
document.addEventListener("astro:page-load", () => {
36+
console.log("ASSET_URL is set to:", ASSET_URL);
3437
const buttons = document.querySelectorAll(
3538
"[data-asset]",
3639
) as NodeListOf<HTMLButtonElement>;

src/types/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export interface Config {
66
// Default: 8080
77
port?: number;
88

9-
// The source of static assets, limited to specific values
10-
assets?: "local" | "github";
9+
// The source of static assets
10+
assets?: "local" | "external";
1111
};
1212

1313
// Authentication configuration

0 commit comments

Comments
 (0)