Compare commits
10 Commits
100a5056eb
...
e3f86e1b54
Author | SHA1 | Date |
---|---|---|
Alex Gleason | e3f86e1b54 | |
Alex Gleason | 3b6ebc651b | |
Alex Gleason | 9c640ca86b | |
Alex Gleason | fe46db3e04 | |
Alex Gleason | 91fe7acbd2 | |
Alex Gleason | 7186f49316 | |
Alex Gleason | d06cafd0dd | |
Alex Gleason | 75c165371a | |
Alex Gleason | 5658c5db08 | |
Alex Gleason | 44fe0c5e1d |
|
@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [1.0.0] - 2024-06-14
|
||||||
|
|
||||||
- Initial release
|
- Initial release
|
||||||
|
|
||||||
[unreleased]: https://gitlab.com/soapbox-pub/ditto/-/compare/main...HEAD
|
[unreleased]: https://gitlab.com/soapbox-pub/ditto/-/compare/v1.0.0...HEAD
|
||||||
|
[1.0.0]: https://gitlab.com/soapbox-pub/ditto/-/tags/v1.0.0
|
||||||
|
|
|
@ -7,8 +7,6 @@ For more info see: https://docs.soapbox.pub/ditto/
|
||||||
|
|
||||||
<img width="400" src="ditto-planet.png">
|
<img width="400" src="ditto-planet.png">
|
||||||
|
|
||||||
⚠️ This software is a work in progress.
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- [x] Built-in Nostr relay
|
- [x] Built-in Nostr relay
|
||||||
|
@ -18,9 +16,9 @@ For more info see: https://docs.soapbox.pub/ditto/
|
||||||
- [x] Reposts
|
- [x] Reposts
|
||||||
- [x] Notifications
|
- [x] Notifications
|
||||||
- [x] Profiles
|
- [x] Profiles
|
||||||
- [ ] Search
|
- [x] Search
|
||||||
- [x] Moderation
|
- [x] Moderation
|
||||||
- [ ] Zaps
|
- [x] Zaps
|
||||||
- [x] Customizable
|
- [x] Customizable
|
||||||
- [x] Open source
|
- [x] Open source
|
||||||
- [x] Self-hosted
|
- [x] Self-hosted
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
"@db/sqlite": "jsr:@db/sqlite@^0.11.1",
|
"@db/sqlite": "jsr:@db/sqlite@^0.11.1",
|
||||||
"@isaacs/ttlcache": "npm:@isaacs/ttlcache@^1.4.1",
|
"@isaacs/ttlcache": "npm:@isaacs/ttlcache@^1.4.1",
|
||||||
"@noble/secp256k1": "npm:@noble/secp256k1@^2.0.0",
|
"@noble/secp256k1": "npm:@noble/secp256k1@^2.0.0",
|
||||||
"@nostrify/nostrify": "jsr:@nostrify/nostrify@^0.23.1",
|
"@nostrify/nostrify": "jsr:@nostrify/nostrify@^0.23.2",
|
||||||
"@scure/base": "npm:@scure/base@^1.1.6",
|
"@scure/base": "npm:@scure/base@^1.1.6",
|
||||||
"@sentry/deno": "https://deno.land/x/sentry@7.112.2/index.mjs",
|
"@sentry/deno": "https://deno.land/x/sentry@7.112.2/index.mjs",
|
||||||
"@soapbox/kysely-deno-sqlite": "jsr:@soapbox/kysely-deno-sqlite@^2.1.0",
|
"@soapbox/kysely-deno-sqlite": "jsr:@soapbox/kysely-deno-sqlite@^2.1.0",
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
"jsr:@nostrify/nostrify@^0.22.1": "jsr:@nostrify/nostrify@0.22.5",
|
"jsr:@nostrify/nostrify@^0.22.1": "jsr:@nostrify/nostrify@0.22.5",
|
||||||
"jsr:@nostrify/nostrify@^0.22.4": "jsr:@nostrify/nostrify@0.22.4",
|
"jsr:@nostrify/nostrify@^0.22.4": "jsr:@nostrify/nostrify@0.22.4",
|
||||||
"jsr:@nostrify/nostrify@^0.22.5": "jsr:@nostrify/nostrify@0.22.5",
|
"jsr:@nostrify/nostrify@^0.22.5": "jsr:@nostrify/nostrify@0.22.5",
|
||||||
"jsr:@nostrify/nostrify@^0.23.1": "jsr:@nostrify/nostrify@0.23.1",
|
"jsr:@nostrify/nostrify@^0.23.2": "jsr:@nostrify/nostrify@0.23.2",
|
||||||
"jsr:@soapbox/kysely-deno-sqlite@^2.1.0": "jsr:@soapbox/kysely-deno-sqlite@2.2.0",
|
"jsr:@soapbox/kysely-deno-sqlite@^2.1.0": "jsr:@soapbox/kysely-deno-sqlite@2.2.0",
|
||||||
"jsr:@soapbox/stickynotes@^0.4.0": "jsr:@soapbox/stickynotes@0.4.0",
|
"jsr:@soapbox/stickynotes@^0.4.0": "jsr:@soapbox/stickynotes@0.4.0",
|
||||||
"jsr:@std/assert@^0.217.0": "jsr:@std/assert@0.217.0",
|
"jsr:@std/assert@^0.217.0": "jsr:@std/assert@0.217.0",
|
||||||
|
@ -122,11 +122,10 @@
|
||||||
"npm:zod@^3.23.8"
|
"npm:zod@^3.23.8"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"@nostrify/nostrify@0.23.1": {
|
"@nostrify/nostrify@0.23.2": {
|
||||||
"integrity": "7a242dedfe33cf38131696ad96d789d54257cfbfd5b5e63748fe5d53c057d99a",
|
"integrity": "c880fd91b5fe69a6239f98cae62297ffccc2a78d160af4d376dd05899352daf0",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"jsr:@std/encoding@^0.224.1",
|
"jsr:@std/encoding@^0.224.1",
|
||||||
"npm:@scure/base@^1.1.6",
|
|
||||||
"npm:@scure/bip32@^1.4.0",
|
"npm:@scure/bip32@^1.4.0",
|
||||||
"npm:@scure/bip39@^1.3.0",
|
"npm:@scure/bip39@^1.3.0",
|
||||||
"npm:kysely@^0.27.3",
|
"npm:kysely@^0.27.3",
|
||||||
|
@ -1360,7 +1359,7 @@
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"jsr:@bradenmacdonald/s3-lite-client@^0.7.4",
|
"jsr:@bradenmacdonald/s3-lite-client@^0.7.4",
|
||||||
"jsr:@db/sqlite@^0.11.1",
|
"jsr:@db/sqlite@^0.11.1",
|
||||||
"jsr:@nostrify/nostrify@^0.23.1",
|
"jsr:@nostrify/nostrify@^0.23.2",
|
||||||
"jsr:@soapbox/kysely-deno-sqlite@^2.1.0",
|
"jsr:@soapbox/kysely-deno-sqlite@^2.1.0",
|
||||||
"jsr:@soapbox/stickynotes@^0.4.0",
|
"jsr:@soapbox/stickynotes@^0.4.0",
|
||||||
"jsr:@std/assert@^0.225.1",
|
"jsr:@std/assert@^0.225.1",
|
||||||
|
|
|
@ -69,8 +69,17 @@ const nameRequestSchema = z.object({
|
||||||
});
|
});
|
||||||
|
|
||||||
export const nameRequestController: AppController = async (c) => {
|
export const nameRequestController: AppController = async (c) => {
|
||||||
|
const store = await Storages.db();
|
||||||
|
const signer = c.get('signer')!;
|
||||||
|
const pubkey = await signer.getPublicKey();
|
||||||
|
|
||||||
const { name, reason } = nameRequestSchema.parse(await c.req.json());
|
const { name, reason } = nameRequestSchema.parse(await c.req.json());
|
||||||
|
|
||||||
|
const [existing] = await store.query([{ kinds: [3036], authors: [pubkey], '#r': [name], limit: 1 }]);
|
||||||
|
if (existing) {
|
||||||
|
return c.json({ error: 'Name request already exists' }, 400);
|
||||||
|
}
|
||||||
|
|
||||||
const event = await createEvent({
|
const event = await createEvent({
|
||||||
kind: 3036,
|
kind: 3036,
|
||||||
content: reason,
|
content: reason,
|
||||||
|
@ -126,7 +135,7 @@ export const nameRequestsController: AppController = async (c) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ids.size === 0) {
|
if (!ids.size) {
|
||||||
return c.json([]);
|
return c.json([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { Conf } from '@/config.ts';
|
||||||
import { Storages } from '@/storages.ts';
|
import { Storages } from '@/storages.ts';
|
||||||
import { getInstanceMetadata } from '@/utils/instance.ts';
|
import { getInstanceMetadata } from '@/utils/instance.ts';
|
||||||
|
|
||||||
const version = '0.0.0 (compatible; Ditto 0.0.1)';
|
const version = '3.0.0 (compatible; Ditto 1.0.0)';
|
||||||
|
|
||||||
const instanceV1Controller: AppController = async (c) => {
|
const instanceV1Controller: AppController = async (c) => {
|
||||||
const { host, protocol } = Conf.url;
|
const { host, protocol } = Conf.url;
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
|
export async function up(db: Kysely<any>): Promise<void> {
|
||||||
|
await db.schema
|
||||||
|
.createIndex('idx_tags_name')
|
||||||
|
.on('nostr_tags')
|
||||||
|
.column('name')
|
||||||
|
.ifNotExists()
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down(db: Kysely<any>): Promise<void> {
|
||||||
|
await db.schema.dropIndex('idx_tags_name').ifExists().execute();
|
||||||
|
}
|
|
@ -38,7 +38,7 @@ class EventsDB implements NStore {
|
||||||
'p': ({ event, count, value }) => (count < 15 || event.kind === 3) && isNostrId(value),
|
'p': ({ event, count, value }) => (count < 15 || event.kind === 3) && isNostrId(value),
|
||||||
'proxy': ({ count, value }) => count === 0 && isURL(value),
|
'proxy': ({ count, value }) => count === 0 && isURL(value),
|
||||||
'q': ({ event, count, value }) => count === 0 && event.kind === 1 && isNostrId(value),
|
'q': ({ event, count, value }) => count === 0 && event.kind === 1 && isNostrId(value),
|
||||||
'r': ({ event, count, value }) => (event.kind === 1985 ? count < 20 : count < 3) && isURL(value),
|
'r': ({ event, count }) => (event.kind === 1985 ? count < 20 : count < 3),
|
||||||
't': ({ event, count, value }) => (event.kind === 1985 ? count < 20 : count < 5) && value.length < 50,
|
't': ({ event, count, value }) => (event.kind === 1985 ? count < 20 : count < 5) && value.length < 50,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue