Skip to content
Open
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
26 changes: 26 additions & 0 deletions bskyembed/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Run / Test

Install dependencies:

```bash
cd bskyembed
yarn
```

Run the dev server:

```bash
yarn dev
```

You can see the embed homepage at http://localhost:5173

### Testbed

In another terminal window, run the snippet dev script:

```bash
yarn dev-snippet
```

You can then see the testbed page at http://localhost:5173/test
2 changes: 2 additions & 0 deletions bskyembed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"dev-snippet": "tsc --project tsconfig.snippet.json && serve -s dist -p 3000 -n",
"build": "tsc && vite build",
"build-snippet": "tsc --project tsconfig.snippet.json",
"lint": "eslint --cache --ext .js,.jsx,.ts,.tsx src",
Expand All @@ -21,6 +22,7 @@
"eslint-config-preact": "^1.3.0",
"eslint-plugin-simple-import-sort": "^12.0.0",
"postcss": "^8.4.38",
"serve": "^14.2.5",
"tailwindcss": "^3.4.3",
"terser": "^5.43.1",
"typescript": "^5.8.3",
Expand Down
12 changes: 11 additions & 1 deletion bskyembed/snippet/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,19 @@ interface Window {
bluesky: {
scan: (element?: Pick<Element, 'querySelectorAll'>) => void
}
BSKY_DEV_EMBED_URL?: string
}

const EMBED_URL = 'https://embed.bsky.app'
/**
* Allow url to be overwritten during development
*/
const IS_DEV =
window.location.protocol === 'file:' ||
window.location.hostname === 'localhost'
const EMBED_URL =
IS_DEV && window.BSKY_DEV_EMBED_URL
? window.BSKY_DEV_EMBED_URL
: 'https://embed.bsky.app'

window.bluesky = window.bluesky || {
scan,
Expand Down
Loading
Loading