Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add Paste docs, Lima dev guide, deploy workflow, and short link tokens

Manav Rathi952d19bcc481
diff --git a/.github/workflows/web-deploy.yml b/.github/workflows/web-deploy.yml
index a1a7e044ba..6c71eba817 100644
--- a/.github/workflows/web-deploy.yml
+++ b/.github/workflows/web-deploy.yml
@@ -126,6 +126,16 @@ jobs:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy --project-name=ente --commit-dirty=true --branch=deploy/share web/apps/share/out
+ - name: Build paste
+ run: yarn build:paste
+
+ - name: Publish paste
+ uses: cloudflare/wrangler-action@v3
+ with:
+ accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
+ apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
+ command: pages deploy --project-name=ente --commit-dirty=true --branch=deploy/paste web/apps/paste/out
+
- name: Build embed
run: yarn build:embed
diff --git a/docs/docs/.vitepress/sidebar.ts b/docs/docs/.vitepress/sidebar.ts
index 0b3c478727..38ccdb3f10 100644
--- a/docs/docs/.vitepress/sidebar.ts
+++ b/docs/docs/.vitepress/sidebar.ts
@@ -440,6 +440,10 @@ export const sidebar = [
text: "Public links",
link: "/locker/features/sharing/public-links",
},
+ {
+ text: "Ente Paste",
+ link: "/locker/features/sharing/ente-paste",
+ },
],
},
{
@@ -589,6 +593,10 @@ export const sidebar = [
text: "Building mobile apps",
link: "/self-hosting/development/mobile-build",
},
+ {
+ text: "Using Lima for development",
+ link: "/self-hosting/development/lima",
+ },
],
},
{
diff --git a/docs/docs/locker/features/sharing/ente-paste.md b/docs/docs/locker/features/sharing/ente-paste.md
new file mode 100644
index 0000000000..771164f8d0
--- /dev/null
+++ b/docs/docs/locker/features/sharing/ente-paste.md
@@ -0,0 +1,35 @@
+---
+title: Ente Paste
+description: Share sensitive text with one-time, end-to-end encrypted links
+---
+
+# Ente Paste
+
+Ente Paste lets you share short sensitive text (keys, snippets, notes) using a
+one-time, end-to-end encrypted link.
+
+Open [paste.ente.io](https://paste.ente.io), paste your text, and share the
+generated link.
+
+## How it works
+
+1. Your text is encrypted on your device.
+2. Ente stores only ciphertext.
+3. The decryption key stays in the URL fragment (`#...`) and is not sent to
+ Ente's servers.
+4. The link can be opened once.
+
+After a successful open, the paste is deleted. If it is never opened, it
+expires after 24 hours.
+
+## Limits
+
+- Maximum text length: 5000 characters.
+- Anonymous usage: no Ente account required to create or open a paste.
+- One-time access: opening the link consumes it.
+
+## Notes
+
+- Link preview crawlers are ignored so they do not consume your paste.
+- If someone opens an already-consumed or expired link, they will see that the
+ paste is unavailable.
diff --git a/docs/docs/locker/features/sharing/index.md b/docs/docs/locker/features/sharing/index.md
index 56c140ce75..2ae912a1b5 100644
--- a/docs/docs/locker/features/sharing/index.md
+++ b/docs/docs/locker/features/sharing/index.md
@@ -26,12 +26,21 @@ with people who don't use Ente.
Learn more about [Public links](/locker/features/sharing/public-links).
+### Share text via Ente Paste
+
+Use Ente Paste when you need to share sensitive text quickly with a one-time
+link. Pastes are end-to-end encrypted, deleted after first open, and expire
+after 24 hours.
+
+Learn more about [Ente Paste](/locker/features/sharing/ente-paste).
+
## What you can share
-| Content | Share with Ente users | Share via public link |
-| ----------- | --------------------- | --------------------- |
-| Collections | Yes | No |
-| Items | No | Yes |
+| Content | Share with Ente users | Share via public link | Share via Ente Paste |
+| ----------- | --------------------- | --------------------- | -------------------- |
+| Collections | Yes | No | No |
+| Items | No | Yes | No |
+| Text | No | No | Yes |
To share with other Ente users, organize items into a collection and share the
collection. To share individual items with anyone (including non-Ente users),
diff --git a/docs/docs/self-hosting/development/lima.md b/docs/docs/self-hosting/development/lima.md
new file mode 100644
index 0000000000..6b53a4151f
--- /dev/null
+++ b/docs/docs/self-hosting/development/lima.md
@@ -0,0 +1,107 @@
+---
+title: Using Lima for development
+description:
+ Running Museum (server + DB) and web apps in a Lima VM for local
+ development
+---
+
+# Using Lima for development
+
+This guide shows a practical Lima workflow for local development on macOS.
+
+It runs:
+
+- Museum + Postgres via Docker Compose
+- Ente Paste web app on port `3008`
+
+## 1. Start Lima
+
+```sh
+limactl start template://docker
+```
+
+Then verify shell access:
+
+```sh
+limactl shell docker /bin/bash -lc 'id && uname -a'
+```
+
+## 2. Clone repo inside the VM
+
+Using a VM-local clone avoids host-mount permission differences.
+
+```sh
+limactl shell docker /bin/bash -lc '
+ cd ~ &&
+ git clone https://github.com/ente-io/ente.git &&
+ cd ente &&
+ git submodule update --init --recursive
+'
+```
+
+## 3. Start Museum + Postgres
+
+```sh
+limactl shell docker /bin/bash -lc '
+ cd ~/ente/server &&
+ touch museum.yaml &&
+ mkdir -p data &&
+ cat > museum.yaml <<EOF
+apps:
+ public-paste: http://localhost:3008
+EOF
+ sudo docker compose up -d --build
+'
+```
+
+Check health:
+
+```sh
+limactl shell docker /bin/bash -lc 'curl -fsS http://localhost:8080/ping'
+```
+
+## 4. Run Ente Paste web app
+
+Run this in a separate terminal:
+
+```sh
+limactl shell docker /bin/bash -lc '
+ sudo docker run --rm --name paste-dev \
+ -p 3008:3008 \
+ -v "$HOME/ente/web:/workspace" \
+ -w /workspace \
+ -e NEXT_PUBLIC_ENTE_ENDPOINT=http://localhost:8080 \
+ node:22-bookworm \
+ bash -lc "
+ corepack enable &&
+ corepack prepare [email protected] --activate &&
+ yarn install --frozen-lockfile &&
+ yarn workspace paste next dev -p 3008
+ "
+'
+```
+
+## 5. Open in browser
+
+- Paste app: `http://localhost:3008`
+- Museum API: `http://localhost:8080/ping`
+
+If localhost ports are not reachable from your host, create an SSH tunnel:
+
+```sh
+ssh -F ~/.lima/docker/ssh.config \
+ -N \
+ -L 8080:127.0.0.1:8080 \
+ -L 3008:127.0.0.1:3008 \
+ lima-docker
+```
+
+## 6. Stop services
+
+```sh
+limactl shell docker /bin/bash -lc '
+ cd ~/ente/server &&
+ sudo docker compose down &&
+ sudo docker rm -f paste-dev >/dev/null 2>&1 || true
+'
+```
diff --git a/docs/docs/self-hosting/installation/config.md b/docs/docs/self-hosting/installation/config.md
index 0b4635567c..c47153b7cf 100644
--- a/docs/docs/self-hosting/installation/config.md
+++ b/docs/docs/self-hosting/installation/config.md
@@ -62,7 +62,8 @@ above and `ENTE_S3_B2_EU_CEN_ENDPOINT` overrides `s3.b2-eu-cen.endpoint`.
### App Endpoints
-The web apps for Ente (Auth, Cast, Albums) use different endpoints.
+The web apps for Ente (Accounts, Cast, Albums, Share, Paste, Embed) use
+different endpoints.
These endpoints are configurable in `museum.yaml` under the apps.\* section.
@@ -73,6 +74,8 @@ used for Compose and quickstart for ease of use.)
| Variable | Description | Default |
| -------------------- | ------------------------------------------------------- | -------------------------- |
| `apps.public-albums` | Albums app base endpoint for public sharing | `https://albums.ente.io` |
+| `apps.public-locker` | Public Locker (share) app base endpoint | `https://share.ente.io` |
+| `apps.public-paste` | Ente Paste app base endpoint | `https://paste.ente.io` |
| `apps.cast` | Cast app base endpoint | `https://cast.ente.io` |
| `apps.embed-albums` | Embed app base endpoint for embedded sharing | `https://embed.ente.io` |
| `apps.accounts` | Accounts app base endpoint (used for passkey-based 2FA) | `https://accounts.ente.io` |
diff --git a/docs/docs/self-hosting/installation/env-var.md b/docs/docs/self-hosting/installation/env-var.md
index 1dae67f874..7c87d7be12 100644
--- a/docs/docs/self-hosting/installation/env-var.md
+++ b/docs/docs/self-hosting/installation/env-var.md
@@ -52,5 +52,6 @@ in `ports` in compose file.
| [Ente Cast](https://ente.io/help/photos/features/cast/) | Web | 3004 | 3004 |
| Ente Public Locker | Web | 3005 | 3005 |
| Ente Embed | Web | 3006 | 3006 |
+| Ente Paste (if deployed separately) | Web | 3008 | 3008 |
| MinIO | S3 | 3200 | 3200 |
| PostgreSQL | Database | | 5432 |
diff --git a/docs/docs/self-hosting/installation/post-install/index.md b/docs/docs/self-hosting/installation/post-install/index.md
index bf24dc2aee..7191815ee0 100644
--- a/docs/docs/self-hosting/installation/post-install/index.md
+++ b/docs/docs/self-hosting/installation/post-install/index.md
@@ -93,7 +93,8 @@ docker compose down && docker compose up -d
## Step 3: Configure application endpoints
-You may wish to access some of the applications such as Auth, Albums, Cast via
+You may wish to access some of the applications such as Albums, Share, Paste,
+Cast, Accounts via
your instance's endpoints through the application instead of our production
instances.
@@ -104,10 +105,17 @@ endpoints of the corresponding web applications.
# Replace yourdomain.tld with actual domain
apps:
public-albums: https://albums.ente.yourdomain.tld
+ public-locker: https://share.ente.yourdomain.tld
+ public-paste: https://paste.ente.yourdomain.tld
cast: https://cast.ente.yourdomain.tld
- auth: https://auth.ente.yourdomain.tld
+ embed-albums: https://embed.ente.yourdomain.tld
+ accounts: https://accounts.ente.yourdomain.tld
```
+If you are using quickstart, note that only Photos and Albums are exposed by
+default in `compose.yaml`. Expose or deploy Share / Paste separately before
+pointing `apps.public-locker` / `apps.public-paste` to those URLs.
+
## Step 4: Make it publicly accessible
You may wish to access Ente on public Internet. You can do so by configuring a
diff --git a/server/pkg/controller/public/paste.go b/server/pkg/controller/public/paste.go
index 6edeec2ef7..798bcbe918 100644
--- a/server/pkg/controller/public/paste.go
+++ b/server/pkg/controller/public/paste.go
@@ -11,15 +11,15 @@ import (
entebase "github.com/ente-io/museum/ente/base"
enteJWT "github.com/ente-io/museum/ente/jwt"
"github.com/ente-io/museum/pkg/repo/public"
- "github.com/ente-io/museum/pkg/utils/random"
timeUtil "github.com/ente-io/museum/pkg/utils/time"
"github.com/ente-io/stacktrace"
"github.com/gin-gonic/gin"
"github.com/golang-jwt/jwt/v4"
+ "github.com/lithammer/shortuuid/v3"
)
const (
- pasteAccessTokenLength = 12
+ pasteAccessTokenLength = 10
maxCiphertextBytes = 64 * 1024
pasteTTL = 24 * time.Hour
guardTTL = 2 * time.Minute
@@ -42,10 +42,7 @@ func (c *PasteController) Create(
expiresAt := timeUtil.Microseconds() + pasteTTL.Microseconds()
for attempt := 0; attempt < 5; attempt++ {
- accessToken, err := random.GenerateAlphaNumString(pasteAccessTokenLength)
- if err != nil {
- return nil, stacktrace.Propagate(err, "failed to generate access token")
- }
+ accessToken := strings.ToUpper(shortuuid.New()[0:pasteAccessTokenLength])
idPtr, err := entebase.NewID("ppt")
if err != nil {
return nil, stacktrace.Propagate(err, "failed to generate paste id")