Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,56 +14,60 @@ Quickly spin up your multi command projects.
### Debian based systems

To install the required packages on a debian based system you can use the following command:

```bash
sudo apt install libgtk-3-0 libwebkit2gtk-4.0-dev nginx dnsmasq
```

> **Note**
>
> [!NOTE]
> For Ubuntu 24.04 and up, you should install `libwebkit2gtk-4.1-dev` instead of `libwebkit2gtk-4.0-dev`.

Download the `.deb` package from the releases. There is a separate version for Ubuntu 24.04 due to the different `libwebkit2gtk` package version being used.

To install the package run the following command where `{{version}}` is the version of the package:

```bash
sudo dpkg -i spinup-{{version}}.deb
```

### RPM based systems

> **Warning**
>
> [!WARNING]
> This has not been tested

To install the required packages on a rpm based system you can use the following command:

```bash
sudo dnf install nginx dnsmasq
```

Download the `.rpm` package from the releases.

To install the package run the following command where `{{version}}` is the version of the package:

```bash
sudo rpm -i spinup-{{version}}.rpm
```

### MacOS

> **Warning**
>
> [!WARNING]
> This has not been tested

Install the required packages:

```bash
brew install nginx dnsmasq
```

Download the `spinup-{{version}}-macos.zip` archive from the releases and unzip the archive:

```bash
unzip spinup-{{version}}-macos.zip
```

Run the installation script:

```bash
sudo ./spinup-{{version}}-macos/install.sh
```
Expand Down
13 changes: 13 additions & 0 deletions app/settings.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package app

func (a *App) GetSettings() (map[string]interface{}, error) {
return a.core.GetConfig().GetSettings()
}

func (a *App) GetSetting(settingKey string) (interface{}, error) {
return a.core.GetConfig().GetSetting(settingKey)
}

func (a *App) SetSetting(settingKey string, value interface{}) error {
return a.core.GetConfig().SetSetting(settingKey, value)
}
89 changes: 89 additions & 0 deletions config/settings.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package config

import (
"encoding/json"
"fmt"
"os"
"path"
)

const settingsFileName = "settings.json"

func (c *Config) writeSettings(settings map[string]interface{}) error {
settingFilePath := path.Join(c.configDir, settingsFileName)

data, err := json.MarshalIndent(settings, "", " ")

if err != nil {
return fmt.Errorf("could not marshal settings: %w", err)
}

err = os.WriteFile(settingFilePath, data, 0644)

if err != nil {
return fmt.Errorf("could not write settings file: %w", err)
}

return nil
}

func (c *Config) GetSettings() (map[string]interface{}, error) {
settingFilePath := path.Join(c.configDir, settingsFileName)
settings := make(map[string]interface{})

data, err := os.ReadFile(settingFilePath)

if os.IsNotExist(err) {
// If the settings file does not exist we should create it.
err = c.writeSettings(settings)

if err != nil {
return nil, fmt.Errorf("could not create settings file: %w", err)
}

// Initialize settings data with an empty JSON object
data = []byte("{}")
}

if err != nil {
return nil, fmt.Errorf("could not read settings file: %w", err)
}

err = json.Unmarshal(data, &settings)

if err != nil {
return nil, fmt.Errorf("could not unmarshal settings: %w", err)
}

return settings, nil
}

func (c *Config) GetSetting(settingKey string) (interface{}, error) {
settings, err := c.GetSettings()
if err != nil {
return nil, fmt.Errorf("could not read settings: %w", err)
}

value, exists := settings[settingKey]
if !exists {
return nil, fmt.Errorf("setting %s does not exist", settingKey)
}

return value, nil
}

func (c *Config) SetSetting(settingKey string, value interface{}) error {
settings, err := c.GetSettings()

if err != nil {
return fmt.Errorf("could not read settings: %w", err)
}

settings[settingKey] = value
err = c.writeSettings(settings)

if err != nil {
return fmt.Errorf("could not write settings: %w", err)
}
return nil
}
6 changes: 6 additions & 0 deletions frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"singleQuote": true,
"printWidth": 120,
"trailingComma": "es5"
}
38 changes: 20 additions & 18 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,35 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
"preview": "vite preview",
"format": "prettier --write ."
},
"dependencies": {
"@heroicons/react": "^2.2.0",
"@radix-ui/react-slot": "^1.1.1",
"@tanstack/react-router": "^1.95.3",
"@radix-ui/react-slot": "^1.2.3",
"@tanstack/react-router": "^1.129.8",
"ansi-to-html": "^0.7.2",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-hot-toast": "^2.5.1",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-hot-toast": "^2.5.2",
"tailwind-merge": "^2.6.0",
"zustand": "^5.0.3"
"zustand": "^5.0.6"
},
"devDependencies": {
"@tanstack/router-devtools": "^1.95.3",
"@tanstack/router-plugin": "^1.95.3",
"@types/node": "^22.10.10",
"@types/react": "^19.0.4",
"@types/react-dom": "^19.0.2",
"@vitejs/plugin-react": "^4.3.4",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.49",
"@tanstack/router-devtools": "^1.129.8",
"@tanstack/router-plugin": "^1.129.8",
"@types/node": "^24.1.0",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitejs/plugin-react": "^4.7.0",
"autoprefixer": "^10.4.21",
"postcss": "^8.5.6",
"prettier": "^3.6.2",
"tailwindcss": "^3.4.17",
"typescript": "^5.3.0",
"vite": "^6.0.7"
"typescript": "^5.8.3",
"vite": "^7.0.6"
},
"packageManager": "pnpm@9.15.3"
"packageManager": "pnpm@10.13.1"
}
2 changes: 1 addition & 1 deletion frontend/package.json.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
621b27dc8aeeef054fb3a519be6af474
e3c57baa7302a52609ea4be5cb3ac460
Loading