-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 0073148
Showing
10 changed files
with
718 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Validate Tag Format | ||
run: | | ||
echo "Validating tag $GITHUB_REF..." | ||
if [[ ! "$GITHUB_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+(\.[0-9]+)*)?$ ]]; then | ||
echo "Invalid tag format: $GITHUB_REF" | ||
echo "Expected format: vMAJOR.MINOR.PATCH (e.g. v1.0.0)" | ||
echo "(Pre-release tags are also valid, e.g. v1.0.0-alpha)" | ||
exit 1 | ||
fi | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
distribution: goreleaser | ||
version: "~> v2" | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Created by https://www.toptal.com/developers/gitignore/api/go | ||
|
||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/go | ||
|
||
# Build files | ||
masked_fastmail | ||
dist/ |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json | ||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj | ||
project_name: masked_fastmail | ||
version: 2 | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
ldflags: | ||
- -s -w | ||
- "-X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}" | ||
|
||
archives: | ||
- format: tar.gz | ||
# this name template makes the OS and Arch compatible with the results of `uname`. | ||
name_template: >- | ||
{{ .ProjectName }}_ | ||
{{- title .Os }}_ | ||
{{- if eq .Arch "amd64" }}x86_64 | ||
{{- else if eq .Arch "386" }}i386 | ||
{{- else }}{{ .Arch }}{{ end }} | ||
{{- if .Arm }}v{{ .Arm }}{{ end }} | ||
# use zip for windows archives | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
|
||
changelog: | ||
sort: asc | ||
groups: | ||
- title: Features | ||
regexp: "^feat:" | ||
order: 0 | ||
- title: Bug Fixes | ||
regexp: "^fix:" | ||
order: 1 | ||
- title: Others | ||
order: 999 | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" | ||
- "^ci:" | ||
- "^chore:" | ||
- "^refactor:" |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright 2024 Fredrik Randsborg Bølstad | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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 |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Masked Fastmail | ||
|
||
A simple CLI tool for managing [Fastmail masked email aliases](https://www.fastmail.com/features/masked-email/). | ||
Easily create new aliases for websites or manage existing ones. | ||
|
||
## Features | ||
|
||
- Get or create masked email addresses for domains | ||
- Aliases are automatically copied to clipboard | ||
- Enable/disable/delete aliases | ||
|
||
## Usage | ||
|
||
![demo](./demo.gif) | ||
|
||
```text | ||
Usage: | ||
masked_fastmail <url> (no flags) | ||
manage_fastmail <alias> [flags] | ||
Flags: | ||
--delete delete alias (bounce messages) | ||
-d, --disable disable alias (send to trash) | ||
-e, --enable enable alias | ||
-h, --help show this message | ||
-v, --version show version information | ||
``` | ||
|
||
The following environment variables must be set: | ||
|
||
```shell | ||
export FASTMAIL_ACCOUNT_ID=your_account_id | ||
export FASTMAIL_API_KEY=your_api_key | ||
``` | ||
|
||
### Examples | ||
|
||
#### Get or create alias | ||
|
||
A new alias will only be created if one does not already exist. | ||
In either case, the alias is automatically copied to the clipboard.[^1] | ||
|
||
[^1]: Copying is done with [Clipboard for Go](https://pkg.go.dev/github.com/atotto/clipboard#section-readme) and should work on all platforms. | ||
|
||
```shell | ||
masked_fastmail example.com | ||
``` | ||
|
||
#### Enable an existing alias | ||
|
||
New Fastmail aliases are initialized to `pending`, and are set to `enabled` once they receive their first email. | ||
However, they get automatically deleted if no email is received within 24 hours. | ||
Some services may not send a timely welcome email, in which case it's helpful to manually enable the alias. | ||
|
||
```shell | ||
masked_fastmail --enable user.1234@fastmail.com | ||
``` | ||
|
||
#### Disable an alias | ||
|
||
This causes all new new emails to be moved to trash. | ||
|
||
```shell | ||
masked_fastmail --disable user.1234@fastmail.com | ||
``` | ||
|
||
## Installation | ||
|
||
### Option 1: Download a pre-built binary | ||
|
||
Download the latest release from the [releases page](https://github.com/fredrikrab/masked_fastmail/releases). | ||
|
||
### Option 2: Use `go install` | ||
|
||
```shell | ||
go install github.com/fredrikrab/masked_fastmail@latest | ||
``` | ||
|
||
### Option 3: Build from source | ||
|
||
1. Clone the repository | ||
2. Run `go build -o masked_fastmail` | ||
|
||
#### Prerequisites | ||
|
||
- Go 1.22+ | ||
- Fastmail API credentials | ||
|
||
#### API documentation | ||
|
||
- The API documentation can be found at [https://www.fastmail.com/dev/maskedemail](https://www.fastmail.com/dev/maskedemail) | ||
- It's also helpful to review the [JMAP protocol](https://jmap.io/crash-course.html) | ||
|
||
## License | ||
|
||
BSD 3-Clause License |
Oops, something went wrong.