Compare commits

..

10 Commits

Author SHA1 Message Date
Alex Gleason e3f86e1b54
README: remove WIP comment
Although it is, we don't need to warn people about that anymore
2024-06-14 08:34:54 -05:00
Alex Gleason 3b6ebc651b
README: check all the boxes 2024-06-14 08:34:10 -05:00
Alex Gleason 9c640ca86b
Change verson to v1.0.0 2024-06-14 08:32:49 -05:00
Alex Gleason fe46db3e04 Merge branch 'index-tag-name' into 'main'
Index nostr_tags.name

See merge request soapbox-pub/ditto!378
2024-06-14 02:37:58 +00:00
Alex Gleason 91fe7acbd2
Index nostr_tags.name 2024-06-13 21:36:07 -05:00
Alex Gleason 7186f49316
Remove URL restriction from r tag 2024-06-13 19:17:53 -05:00
Alex Gleason d06cafd0dd
nameRequestController: prevent submitting the same name twice 2024-06-13 19:11:59 -05:00
Alex Gleason 75c165371a Merge branch 'nip05-ownership' into 'main'
Bump Nostrify to v0.23.2, fix nameRequestsController

See merge request soapbox-pub/ditto!377
2024-06-13 23:49:03 +00:00
Alex Gleason 5658c5db08 nameRequestsController: `ids.size === 0` => `!ids.size` 2024-06-13 23:47:12 +00:00
Alex Gleason 44fe0c5e1d
Bump Nostrify to v0.23.2 2024-06-13 18:43:04 -05:00
8 changed files with 37 additions and 14 deletions

View File

@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [1.0.0] - 2024-06-14
- 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

View File

@ -7,8 +7,6 @@ For more info see: https://docs.soapbox.pub/ditto/
<img width="400" src="ditto-planet.png">
⚠️ This software is a work in progress.
## Features
- [x] Built-in Nostr relay
@ -18,9 +16,9 @@ For more info see: https://docs.soapbox.pub/ditto/
- [x] Reposts
- [x] Notifications
- [x] Profiles
- [ ] Search
- [x] Search
- [x] Moderation
- [ ] Zaps
- [x] Zaps
- [x] Customizable
- [x] Open source
- [x] Self-hosted

View File

@ -23,7 +23,7 @@
"@db/sqlite": "jsr:@db/sqlite@^0.11.1",
"@isaacs/ttlcache": "npm:@isaacs/ttlcache@^1.4.1",
"@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",
"@sentry/deno": "https://deno.land/x/sentry@7.112.2/index.mjs",
"@soapbox/kysely-deno-sqlite": "jsr:@soapbox/kysely-deno-sqlite@^2.1.0",

View File

@ -10,7 +10,7 @@
"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.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/stickynotes@^0.4.0": "jsr:@soapbox/stickynotes@0.4.0",
"jsr:@std/assert@^0.217.0": "jsr:@std/assert@0.217.0",
@ -122,11 +122,10 @@
"npm:zod@^3.23.8"
]
},
"@nostrify/nostrify@0.23.1": {
"integrity": "7a242dedfe33cf38131696ad96d789d54257cfbfd5b5e63748fe5d53c057d99a",
"@nostrify/nostrify@0.23.2": {
"integrity": "c880fd91b5fe69a6239f98cae62297ffccc2a78d160af4d376dd05899352daf0",
"dependencies": [
"jsr:@std/encoding@^0.224.1",
"npm:@scure/base@^1.1.6",
"npm:@scure/bip32@^1.4.0",
"npm:@scure/bip39@^1.3.0",
"npm:kysely@^0.27.3",
@ -1360,7 +1359,7 @@
"dependencies": [
"jsr:@bradenmacdonald/s3-lite-client@^0.7.4",
"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/stickynotes@^0.4.0",
"jsr:@std/assert@^0.225.1",

View File

@ -69,8 +69,17 @@ const nameRequestSchema = z.object({
});
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 [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({
kind: 3036,
content: reason,
@ -126,7 +135,7 @@ export const nameRequestsController: AppController = async (c) => {
}
}
if (ids.size === 0) {
if (!ids.size) {
return c.json([]);
}

View File

@ -3,7 +3,7 @@ import { Conf } from '@/config.ts';
import { Storages } from '@/storages.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 { host, protocol } = Conf.url;

View File

@ -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();
}

View File

@ -38,7 +38,7 @@ class EventsDB implements NStore {
'p': ({ event, count, value }) => (count < 15 || event.kind === 3) && isNostrId(value),
'proxy': ({ count, value }) => count === 0 && isURL(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,
};