-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
433 additions
and
438 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,74 @@ | ||
# tamako🐞 | ||
|
||
[](https://ci.codeberg.org/repos/12523) | ||
[](https://crates.io/crates/tamako) | ||
[](https://deps.rs/repo/codeberg/fawn/tamako) | ||
|
||
tamako is a cozy, minimalistic, single-user, _anonymous_ whispers service | ||
|
||
 | ||
|
||
## Prerequisites | ||
|
||
- [sqlx-cli](https://crates.io/crates/sqlx-cli) | ||
- a postgresql database | ||
|
||
## Environment variables | ||
|
||
| Name | Type | Default | Notes | | ||
| ------------------------- | ------ | ------------------------- | ------------------------------------------------------------------------------------------------------------------ | | ||
| `TAMAKO_HOST` | String | 127.0.0.1 | the host to run the server on | | ||
| `TAMAKO_PORT` | u16 | 8715 | the port to serve the server on | | ||
| `DATABASE_URL` | String | _none_ | the database url. this should be a valid postgresql connection url | | ||
| `WEBHOOK_URL` | String | _none_ | _(optional)_ the discord webhook url. this will be used to send _private and public_ whispers to a discord channel | | ||
| `TAMAKO_SECRET` | String | _none_ | the secret key used for authentication. think of it like a master password | | ||
| `TAMAKO_USER_NAME` | String | tamako | _(optional)_ used in the fronted header | | ||
| `TAMAKO_USER_DESCRIPTION` | String | Cozy anonymous whispers 🐞 | _(optional)_ used in the fronted header | | ||
|
||
## Installation | ||
|
||
### Docker Compose (Recommended) | ||
|
||
This will also create a postgres service container. | ||
|
||
1. Clone the repo | ||
2. Configure `docker-compose.yml` to match your setup, most importantly change the environment variables | ||
3. `docker compose up -d` | ||
|
||
### Locally | ||
|
||
1. Clone the repo | ||
2. Rename `.env.example` to `.env` and change env variables inside it | ||
3. Build tamako: `cargo build --release` | ||
4. Run tamako: `./target/release/tamako` | ||
|
||
### Docker | ||
|
||
Using docker directly is possible, but you have to configure the container yourself. | ||
|
||
```sh | ||
docker run -d --name tamako --restart unless-stopped -p 8715:8715 fawni/tamako:latest | ||
``` | ||
|
||
## TUI | ||
|
||
tamako comes with a pretty little tui frontend for it called mochi | ||
|
||
 | ||
|
||
### Installation | ||
|
||
```sh | ||
go install codeberg.org/fawn/tamako/cmd/mochi@latest | ||
``` | ||
### Usage | ||
|
||
```sh | ||
mochi --url https://tamako.fawn.moe | ||
``` | ||
|
||
`mochi -h` for more info. | ||
|
||
## License | ||
|
||
# tamako🐞 | ||
|
||
[](https://ci.codeberg.org/repos/12523) | ||
[](https://crates.io/crates/tamako) | ||
[](https://deps.rs/repo/codeberg/fawn/tamako) | ||
|
||
tamako is a cozy, minimalistic, single-user, _anonymous_ whispers service | ||
|
||
 | ||
|
||
## Prerequisites | ||
|
||
- [sqlx-cli](https://crates.io/crates/sqlx-cli) | ||
- a postgresql database | ||
|
||
## Environment variables | ||
|
||
| Name | Type | Default | Notes | | ||
| ------------------------- | ------ | ------------------------- | ------------------------------------------------------------------------------------------------------------------ | | ||
| `TAMAKO_HOST` | String | 127.0.0.1 | the host to run the server on | | ||
| `TAMAKO_PORT` | u16 | 8715 | the port to serve the server on | | ||
| `DATABASE_URL` | String | _none_ | the database url. this should be a valid postgresql connection url | | ||
| `WEBHOOK_URL` | String | _none_ | _(optional)_ the discord webhook url. this will be used to send _private and public_ whispers to a discord channel | | ||
| `TAMAKO_SECRET` | String | _none_ | the secret key used for authentication. think of it like a master password | | ||
| `TAMAKO_USER_NAME` | String | tamako | _(optional)_ used in the fronted header | | ||
| `TAMAKO_USER_DESCRIPTION` | String | Cozy anonymous whispers 🐞 | _(optional)_ used in the fronted header | | ||
|
||
## Installation | ||
|
||
### Docker Compose (Recommended) | ||
|
||
This will also create a postgres service container. | ||
|
||
1. Clone the repo | ||
2. Configure `docker-compose.yml` to match your setup, most importantly change the environment variables | ||
3. `docker compose up -d` | ||
|
||
### Locally | ||
|
||
1. Clone the repo | ||
2. Rename `.env.example` to `.env` and change env variables inside it | ||
3. Build tamako: `cargo build --release` | ||
4. Run tamako: `./target/release/tamako` | ||
|
||
### Docker | ||
|
||
Using docker directly is possible, but you have to configure the container yourself. | ||
|
||
```sh | ||
docker run -d --name tamako --restart unless-stopped -p 8715:8715 fawni/tamako:latest | ||
``` | ||
|
||
## TUI | ||
|
||
tamako comes with a pretty little tui frontend for it called mochi | ||
|
||
 | ||
|
||
### Installation | ||
|
||
```sh | ||
go install codeberg.org/fawn/tamako/cmd/mochi@latest | ||
``` | ||
### Usage | ||
|
||
```sh | ||
mochi --url https://tamako.fawn.moe | ||
``` | ||
|
||
`mochi -h` for more info. | ||
|
||
## License | ||
|
||
[OSL-3.0](LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
package keys | ||
|
||
import "github.com/charmbracelet/bubbles/key" | ||
|
||
type Keymap struct { | ||
Copy key.Binding | ||
Refresh key.Binding | ||
Delete key.Binding | ||
} | ||
|
||
func NewKeymap() *Keymap { | ||
return &Keymap{ | ||
Copy: key.NewBinding( | ||
key.WithKeys("enter"), | ||
key.WithHelp("enter", "copy"), | ||
), | ||
Refresh: key.NewBinding( | ||
key.WithKeys("r"), | ||
key.WithHelp("r", "refresh"), | ||
), | ||
Delete: key.NewBinding( | ||
key.WithKeys("delete"), | ||
key.WithHelp("delete", "delete"), | ||
key.WithDisabled(), // TODO: implement auth | ||
), | ||
} | ||
} | ||
package keys | ||
|
||
import "github.com/charmbracelet/bubbles/key" | ||
|
||
type Keymap struct { | ||
Copy key.Binding | ||
Refresh key.Binding | ||
Delete key.Binding | ||
} | ||
|
||
func NewKeymap() *Keymap { | ||
return &Keymap{ | ||
Copy: key.NewBinding( | ||
key.WithKeys("enter"), | ||
key.WithHelp("enter", "copy"), | ||
), | ||
Refresh: key.NewBinding( | ||
key.WithKeys("r"), | ||
key.WithHelp("r", "refresh"), | ||
), | ||
Delete: key.NewBinding( | ||
key.WithKeys("delete"), | ||
key.WithHelp("delete", "delete"), | ||
key.WithDisabled(), // TODO: implement auth | ||
), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
package minimal | ||
|
||
import ( | ||
"fmt" | ||
|
||
"codeberg.org/fawn/tamako/cmd/mochi/tamako" | ||
"codeberg.org/fawn/tamako/cmd/mochi/tui/styles" | ||
) | ||
|
||
func Render(w tamako.Whisper) { | ||
res := titleMargin(styles.TitleStyle.Render("tamako") + fmt.Sprintf(" - %s", snowflakeStyle(fmt.Sprintf("%d", w.Snowflake)))) | ||
res += line("\nName", name(w.Name)) | ||
res += line("Message", w.Message) | ||
res += line("Private", fmt.Sprintf("%t", w.Private)) | ||
res += line("Timestamp", w.Timestamp) | ||
|
||
fmt.Println(res) | ||
} | ||
|
||
func name(n string) string { | ||
if n == "anon" { | ||
return mutedStyle(n) | ||
} | ||
return n | ||
} | ||
|
||
func line(key string, value string) string { | ||
return textStyle(fmt.Sprintf("%s: %s", keyStyle(key), value)) + "\n" | ||
} | ||
package minimal | ||
|
||
import ( | ||
"fmt" | ||
|
||
"codeberg.org/fawn/tamako/cmd/mochi/tamako" | ||
"codeberg.org/fawn/tamako/cmd/mochi/tui/styles" | ||
) | ||
|
||
func Render(w tamako.Whisper) { | ||
res := titleMargin(styles.TitleStyle.Render("tamako") + fmt.Sprintf(" - %s", snowflakeStyle(fmt.Sprintf("%d", w.Snowflake)))) | ||
res += line("\nName", name(w.Name)) | ||
res += line("Message", w.Message) | ||
res += line("Private", fmt.Sprintf("%t", w.Private)) | ||
res += line("Timestamp", w.Timestamp) | ||
|
||
fmt.Println(res) | ||
} | ||
|
||
func name(n string) string { | ||
if n == "anon" { | ||
return mutedStyle(n) | ||
} | ||
return n | ||
} | ||
|
||
func line(key string, value string) string { | ||
return textStyle(fmt.Sprintf("%s: %s", keyStyle(key), value)) + "\n" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
package minimal | ||
|
||
import ( | ||
"codeberg.org/fawn/tamako/cmd/mochi/tui/styles" | ||
lg "github.com/charmbracelet/lipgloss" | ||
) | ||
|
||
var ( | ||
titleMargin = lg.NewStyle().Margin(1, 0, 1, 2).Render | ||
textStyle = lg.NewStyle().MarginLeft(2).Render | ||
keyStyle = lg.NewStyle().Foreground(styles.Colors.Primary).Bold(true).Render | ||
mutedStyle = lg.NewStyle().Foreground(styles.Colors.Muted).Italic(true).Render | ||
snowflakeStyle = lg.NewStyle().Italic(true).Render | ||
) | ||
package minimal | ||
|
||
import ( | ||
"codeberg.org/fawn/tamako/cmd/mochi/tui/styles" | ||
lg "github.com/charmbracelet/lipgloss" | ||
) | ||
|
||
var ( | ||
titleMargin = lg.NewStyle().Margin(1, 0, 1, 2).Render | ||
textStyle = lg.NewStyle().MarginLeft(2).Render | ||
keyStyle = lg.NewStyle().Foreground(styles.Colors.Primary).Bold(true).Render | ||
mutedStyle = lg.NewStyle().Foreground(styles.Colors.Muted).Italic(true).Render | ||
snowflakeStyle = lg.NewStyle().Italic(true).Render | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
package styles | ||
|
||
import ( | ||
"github.com/charmbracelet/bubbles/list" | ||
) | ||
|
||
func NewListDelegate() list.DefaultDelegate { | ||
d := list.NewDefaultDelegate() | ||
d.Styles.SelectedTitle = d.Styles.SelectedTitle.Foreground(Colors.Primary).BorderLeftForeground(Colors.Primary) | ||
d.Styles.SelectedDesc = d.Styles.SelectedDesc.Foreground(Colors.Secondary).BorderLeftForeground(Colors.Primary) | ||
d.Styles.NormalTitle = d.Styles.NormalTitle.Foreground(Colors.Text) | ||
d.Styles.NormalDesc = d.Styles.NormalDesc.Foreground(Colors.Muted) | ||
|
||
return d | ||
} | ||
package styles | ||
|
||
import ( | ||
"github.com/charmbracelet/bubbles/list" | ||
) | ||
|
||
func NewListDelegate() list.DefaultDelegate { | ||
d := list.NewDefaultDelegate() | ||
d.Styles.SelectedTitle = d.Styles.SelectedTitle.Foreground(Colors.Primary).BorderLeftForeground(Colors.Primary) | ||
d.Styles.SelectedDesc = d.Styles.SelectedDesc.Foreground(Colors.Secondary).BorderLeftForeground(Colors.Primary) | ||
d.Styles.NormalTitle = d.Styles.NormalTitle.Foreground(Colors.Text) | ||
d.Styles.NormalDesc = d.Styles.NormalDesc.Foreground(Colors.Muted) | ||
|
||
return d | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
package styles | ||
|
||
import lg "github.com/charmbracelet/lipgloss" | ||
|
||
var ( | ||
AppStyle = lg.NewStyle(). | ||
Margin(1, 2) | ||
TitleStyle = lg.NewStyle(). | ||
Foreground(Colors.White). | ||
Background(Colors.Primary). | ||
Bold(true). | ||
Padding(0, 1) | ||
|
||
Primary = lg.NewStyle(). | ||
Foreground(Colors.Primary). | ||
Render | ||
Error = lg.NewStyle(). | ||
Foreground(Colors.Red). | ||
Render | ||
Success = lg.NewStyle(). | ||
Foreground(Colors.Green). | ||
Render | ||
) | ||
package styles | ||
|
||
import lg "github.com/charmbracelet/lipgloss" | ||
|
||
var ( | ||
AppStyle = lg.NewStyle(). | ||
Margin(1, 2) | ||
TitleStyle = lg.NewStyle(). | ||
Foreground(Colors.White). | ||
Background(Colors.Primary). | ||
Bold(true). | ||
Padding(0, 1) | ||
|
||
Primary = lg.NewStyle(). | ||
Foreground(Colors.Primary). | ||
Render | ||
Error = lg.NewStyle(). | ||
Foreground(Colors.Red). | ||
Render | ||
Success = lg.NewStyle(). | ||
Foreground(Colors.Green). | ||
Render | ||
) |
Oops, something went wrong.