diff --git a/README.md b/README.md
index a2cfa023..36318420 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,6 @@ Jump to:
-
## Self-hosting
You selfhost a Photon frontend server for your Lemmy instance, or independently for any instance.
@@ -39,6 +38,7 @@ To run an unconfigured Photon instance on port `8080`:
```sh
docker run -p 8080:3000 ghcr.io/xyphyn/photon:latest
```
+
### Running natively
Clone the repo:
@@ -80,8 +80,11 @@ Photon lets you configure the default client settings and more.
If you're hosting Photon for a Lemmy instance, you' ll almost definitely want to set these:
- `PUBLIC_INSTANCE_URL` `string`: The domain which **the browser** will send API requests to.
+
- Example: `PUBLIC_INSTANCE_URL=fedi.phtn.app`
+- `PUBLIC_INSTANCE_TYPE` `lemmyv3 | piefedalpha` (default: `lemmyv3`): If your instance is running Piefed, you must set this option to `piefedalpha`. Otherwise, you don't need to do anything.
+
- `PUBLIC_SSR_ENABLED` `boolean`: When enabled, will **make page requests be rendered server side first**, which allows search engine indexing, and basic non-js usage.
- `PUBLIC_INTERNAL_INSTANCE` `string`: Only relevant if `PUBLIC_SSR_ENABLED=true`. This is the domain that the **server will make API requests to.**
diff --git a/TODO.md b/TODO.md
deleted file mode 100644
index 865ae160..00000000
--- a/TODO.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Todo
-
-- [ ] Add blocking instances and stuff
diff --git a/package.json b/package.json
index f3581f3a..8f2d18c9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "photon-lemmy",
- "version": "2.0.2",
+ "version": "2.0.3",
"license": "AGPL-3.0-only",
"devDependencies": {
"@dicebear/core": "^8.0.1",
diff --git a/src/lib/client/base.ts b/src/lib/client/base.ts
index 1ef282af..2a943c70 100644
--- a/src/lib/client/base.ts
+++ b/src/lib/client/base.ts
@@ -1,13 +1,20 @@
+import { env } from '$env/dynamic/public'
import * as types from './types'
export type ClientType =
| { name: 'lemmy'; baseUrl: '/api/v3' }
| { name: 'piefed'; baseUrl: '/api/alpha' }
-export const DEFAULT_CLIENT_TYPE: ClientType = {
- name: 'lemmy',
- baseUrl: '/api/v3',
-}
+export const DEFAULT_CLIENT_TYPE: ClientType =
+ env.PUBLIC_INSTANCE_TYPE == 'piefedalpha'
+ ? {
+ name: 'piefed',
+ baseUrl: '/api/alpha',
+ }
+ : {
+ name: 'lemmy',
+ baseUrl: '/api/v3',
+ }
export abstract class BaseClient {
abstract type: ClientType
diff --git a/src/lib/client/lemmy.svelte.ts b/src/lib/client/lemmy.svelte.ts
index 299d3e64..17f83b5c 100644
--- a/src/lib/client/lemmy.svelte.ts
+++ b/src/lib/client/lemmy.svelte.ts
@@ -119,34 +119,3 @@ export async function validateInstance(
return false
}
}
-
-export function mayBeIncompatible(
- minVersion: string,
- availableVersion: string,
-) {
- if (minVersion.valueOf() === availableVersion.valueOf()) return false
-
- const versionFormatter = /[\d.]/
- if (
- !minVersion.match(versionFormatter) ||
- !availableVersion.match(availableVersion)
- ) {
- return true
- }
-
- const splitMinVersion = minVersion.split('.')
- const splitAvailableVersion = availableVersion.split('.')
-
- if (splitMinVersion.length !== splitAvailableVersion.length) return true
-
- for (let i = 0; i < splitMinVersion.length; ++i) {
- const minVersionDigit = parseInt(splitMinVersion[i])
- const availableVersionDigit = parseInt(splitAvailableVersion[i])
-
- if (availableVersionDigit === undefined) return true
- if (minVersionDigit < availableVersionDigit) return false
- if (availableVersionDigit < minVersionDigit) return true
- }
-
- return false
-}
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index 7e223093..763e856c 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -62,7 +62,8 @@
"moveUp": "Move up",
"moveDown": "Move down",
"guest": "Guest",
- "versionGate": "This version of Photon supports instances running {{version}} or higher."
+ "versionGate": "This version of Photon supports instances running {{version}} or higher.",
+ "piefedGate": "Piefed support is experimental. Some features are not supported."
},
"filter": {
"location": {
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 0f8061a8..7d2cf853 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -1,5 +1,6 @@