Compare commits

...

3 commits

18 changed files with 84 additions and 69 deletions

13
Dockerfile Normal file
View file

@ -0,0 +1,13 @@
FROM oven/bun:alpine
ENV HOSTNAME localhost
WORKDIR /startpage
COPY assets ./assets
COPY src ./src
COPY package.json ./
HEALTHCHECK --interval=5s --timeout=5s --retries=3 CMD wget --spider -q http://0.0.0.0/healthcheck || exit 1
ENTRYPOINT [ "bun", "start" ]

View file

@ -1,25 +1,27 @@
# startpage
My startpage, edited from github.com/kencx
<div align="center">
<img src="https://user-images.githubusercontent.com/76164598/170824479-5918fe82-18df-4549-8b20-c2b1595a27d0.png" alt="" align="center" />
<h1 align="center">Startpage</h1>
</div>
# How to use?
# Getting Started
1. git clone this repo
2. copy the path to the index.html file
3. set the path as your default startpage in your desired browser
## Using bun.sh
# Customization
```
bun start
```
### Image(s)
i have included a few vaporwave/retro styled gifs in this repo, you can edit it on the line <b>22</b> in the index.html the ```src="clouds.gif"``` to something like ```src="plane.gif"``` or your own image/gif
## Using docker-compose
### URLs
you can edit all of the URLs to your desired, starting on line **44** in ```index.html```
<br> **Example:** <br>
**line 45:** ```<li><a href="https://github.com/">github</a></li>``` <br >can be changed to <br> **line 45:** ```<li><a href="https://yoururl.com/">your url</a></li>```
```
docker-compose up --build
```
### Categories
# Customize
i think you get it, starting on line **44** you can change the names of the categories etc. etc. i believe you're not dumb and understand
Everything is static, just modify the content as you want in `src/` or `assets`.
# Screenshot
![image](https://user-images.githubusercontent.com/76164598/170824479-5918fe82-18df-4549-8b20-c2b1595a27d0.png)
# Contributors
- [Siklos/Hydroxycarbamide](https://git.siklos-chaneru.dev/Siklos)
- [Woox](https://github.com/nwvh)

View file

Before

Width:  |  Height:  |  Size: 340 KiB

After

Width:  |  Height:  |  Size: 340 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 562 KiB

After

Width:  |  Height:  |  Size: 562 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.4 MiB

After

Width:  |  Height:  |  Size: 2.4 MiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 3 MiB

After

Width:  |  Height:  |  Size: 3 MiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 169 KiB

After

Width:  |  Height:  |  Size: 169 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 4.6 MiB

After

Width:  |  Height:  |  Size: 4.6 MiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1,005 KiB

After

Width:  |  Height:  |  Size: 1,005 KiB

Before After
Before After

BIN
bun.lockb

Binary file not shown.

7
docker-compose.yml Normal file
View file

@ -0,0 +1,7 @@
services:
app:
image: startpage
build: .
restart: unless-stopped
ports:
- "8080:80"

View file

@ -1,48 +0,0 @@
console.log("Hello World!");
const fetch = (req: Request) => {
const url = new URL(req.url);
const path = url.pathname;
if (path === "/") {
return new Response(Bun.file("./index.html"), {
headers: {
"Content-Type": "text/html"
}
});
} else if (path === "/style.css") {
return new Response(Bun.file("./style.css"), {
headers: {
"Content-Type": "text/css"
}
});
} else if (path === "/cat.gif") {
return new Response(Bun.file("./cat.gif"), {
headers: {
"Content-Type": "image/gif"
}
});
} else if (path === "/favicon.ico") {
return new Response(Bun.file("./favicon.ico"), {
headers: {
"Content-Type": "image/x-icon"
}
})
} else if (path.startsWith('/fonts/')) {
const fontPath = path.slice('/fonts/'.length);
return new Response(Bun.file(`./fonts/${fontPath}`), {
headers: {
"Content-Type": "application/octet-stream"
}
})
}
return new Response("404!");
}
Bun.serve({
port: Bun.env.PORT || 80,
hostname: Bun.env.HOSTNAME || "localhost",
fetch
});

View file

@ -1,11 +1,14 @@
{
"name": "startpage",
"module": "index.ts",
"module": "./src/index.ts",
"type": "module",
"scripts": {
"start": "bun run ./src/index.ts"
},
"devDependencies": {
"bun-types": "latest"
"bun-types": "^1.1.31"
},
"peerDependencies": {
"typescript": "^5.0.0"
"typescript": "^5.6.3"
}
}
}

38
src/index.ts Normal file
View file

@ -0,0 +1,38 @@
const fetch = (req: Request) => {
const url = new URL(req.url);
const path = url.pathname;
if (path.startsWith('/fonts/')) {
const fontPath = path.slice('/fonts/'.length);
return new Response(Bun.file(`./assets/fonts/${fontPath}`), {
headers: {
"Content-Type": "application/octet-stream"
}
})
}
return new Response("404!");
};
Bun.serve({
port: Bun.env.PORT || 80,
static: {
"/healthcheck": new Response("All good!"),
"/": new Response(await Bun.file("./src/index.html").bytes(), {
headers: {
"Content-Type": "text/html",
},
}),
"/style.css": new Response(await Bun.file("./src/style.css").bytes(), {
headers: {
"Content-Type": "text/css"
},
}),
"/cat.gif": new Response(await Bun.file("./assets/img/cat.gif").bytes(), {
headers: {
"Content-Type": "image/gif",
},
}),
},
fetch,
});