# vnk (or VNook)

> the current default tracklist is still a TODO.

**vnk is a fork of [Nook Desktop](https://github.com/mn6/nook-desktop) by mn6, reimagined for visual novel lovers and _self-hostability_.**

instead of Animal Crossing hourly music, vnk plays BGMs from Key visual novels (like CLANNAD) and is also easily self-hostable.

i also decided to remove all the telemetry present in Nook from vnk

> modified files may contain a summary explanation of the codebase given what i understood from reading it

---

## how it works

vnk is an electron app. it has two windows:

- **`app/main/`** - the visible UI (HTML + jquery), sends commands to the player via electron IPC.
- **`app/hidden/`** - an invisible audio engine (`player.js`), does all actual audio work.
- **`index.js`** - the clectron main process, creates both windows, handles tray, relays IPC.

---

## codebase map

```
vnook/
├── index.js                   ←  electron main. tray, window creation, IPC relay.
├── package.json               ←  app name, build config, dependencies.
│
├── app/
│   ├── vn.json                ←  add sound metadata here (id, name, tracks[])
│   ├── release-log.json       ←  in-app changelog
│   │
│   ├── hidden/
│   │   └── player.js          ←  audio engine. to self-host change BASE_URL here too.
│   │
│   └── main/
│       ├── index.html         ←  shell HTML (just loads CSS + main.js)
│       ├── js/
│       │   ├── main.js        ←  UI logic, DOM template and event wiring
│       │   └── i18n/          <- contains the translations for the UI
│       └── css/
│           └── main.css       <- contains styles
```

---

## adding a new VN

1. open `app/vn.json`
2. add an entry:
```json
{
  "id": "game_id",
  "name": "fancy game name",
  "tracks": ["Track 1", "Track 2", "Track 3"],
  "description": "a cool description for a fancy game"
}
```
3. put your audio files on your server at `<BASE_URL>/game_id/Track 1.mp3` etc.

that's it. no code changes needed.

---

## changing the audio source (BASE_URL)

### option a: change the hardcoded default

In `app/hidden/player.js`, almost at the top:
```js
const BASE_URL = 'https://website.tld'
```

### option b: set it at runtime (in-app)

open settings -> "Custom audio server URL" -> type your URL -> Save.
this is stored in local settings and overrides the default.

### expected URL format

```
<BASE_URL>/<vnId>/<trackName>.mp3
```

example: `http://localhost:8080/clannad/Nagisa.mp3`

rain sounds:
```
<BASE_URL>/rain/rain.mp3
<BASE_URL>/rain/no-thunder-rain.mp3
<BASE_URL>/rain/game-rain.mp3
```

---

## where to find VN music

> (!) vnk does not bundle any copyrighted audio.
> you need to supply your own files. here's where to look:

### khinsider (best option)

https://downloads.khinsider.com - massive VGM archive, has free FLAC and MP3 downloads.

useful pages:

- CLANNAD OST: `downloads.khinsider.com/game-soundtracks/album/clannad-video-game-original-soundtrack`
- CLANNAD PSP gamerip: `downloads.khinsider.com/game-soundtracks/album/clannad-psp-gamerip-2008`
- AIR OST: `downloads.khinsider.com/game-soundtracks/album/air-original-soundtrack-ive`
- Little Busters: search "little busters" on the site

download the MP3s, name them to match the `tracks` array in `vn.json`, serve with any static file server.

### self-hosting vnk

```bash
# put your .mp3 files in a folder structure like:
# audio/clannad/Nagisa.mp3
# audio/clannad/Snowfield.mp3

npx serve audio -p 8080
# then set BASE_URL to http://localhost:8080
# or just point BASE_URL to your domain
```

---

## running vnk

```bash
npm install
npm start
```

## building vnk

```bash
npm run pack
npm run dist
```

---

## credits

- **Nook Desktop** by [mn6](https://github.com/mn6/nook-desktop) - the original app this is forked from.  
- VN music (c) Key / Visual Arts - please support the creators.

