diff --git a/.replit b/.replit index 5ebcdce9..ce0a7216 100644 --- a/.replit +++ b/.replit @@ -1,4 +1,4 @@ -run = "npm run dev:host" +run = "npm run format && npm run dev:host" onBoot = "npm install" [packager] diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md new file mode 100644 index 00000000..386d5484 --- /dev/null +++ b/DOCUMENTATION.md @@ -0,0 +1,27 @@ +# API Documentation + +## GET /api/entries.json + +Search for entries + +### Params + +All parameters should of course be encoded in the request url as URL query string parameters. + +Note: If there are no parameters, it will fetch all entries. + +- **`tags`**: CSV (comma seperated values) of tags to search for. Eg: "web,programming language,discord user" +- **`query`**: String to search for in article titles and content. +- **`visible`**: Boolean (true/false) of whether to show regular (non unlisted or hidden), 'visible' entries. Defaults to true. +- **`unlisted`**: Boolean (true/false) of whether to show unlisted entries. Some users may not have the proper permissions to view these entries. Defaults to false. +- **`hidden`**: Boolean (true/false) of whether to show hidden entries. Some users may not have the proper permissions to view these entries. Defaults to false. +- **`limit`**: Integer of how many entries it should return. Defaults to all. +- **`skip`**: Integer of how many entries should be skipped (useful for pagination). Defaults to 0 (skip none). + +## POST /api/entries.json + +Creates entry. Probably should not try and do this programatically. + +## GET /api/random.json + +Get random entry. diff --git a/README.md b/README.md index 6bb442cd..30556be8 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,7 @@ Repldex is the unofficial community-editable encyclopedia of user created entrie # Contributing See [CONTRIBUTING.md](CONTRIBUTING.md) + +# API Docs + +Looking for the Repldex api documentation? Go to [DOCUMENTATION.md](DOCUMENTATION.md) diff --git a/src/lib/EntryPreview.svelte b/src/lib/EntryPreview.svelte index c9ae4149..64d0c333 100644 --- a/src/lib/EntryPreview.svelte +++ b/src/lib/EntryPreview.svelte @@ -1,21 +1,52 @@ - +
{ + window.location.href = getEntryViewUrl(entry) + }} +> {#if entry.visibility === 'unlisted'}

Unlisted

{:else if entry.visibility === 'hidden'}

Hidden

{/if} -

{entry.title}

+ +

{entry.title}

{@html markdown.render(entry.content)}

- + + {#if entry.tags} + {#each entry.tags as tag} + { + setTagSearch({ tag }) + event.cancelBubble = true + }} + > + {tag} + + {/each} + {/if} +
diff --git a/src/routes/login.ts b/src/routes/login.ts index 75bf2c42..79bf4959 100644 --- a/src/routes/login.ts +++ b/src/routes/login.ts @@ -52,7 +52,6 @@ export const get: RequestHandler = async req => { }).then(res => res.json()) if (!discordUserData.id) { - console.log(discordUserData) throw new Error('Failed to get user data from Discord') } @@ -64,6 +63,7 @@ export const get: RequestHandler = async req => { }) let sessionId: string + if (existingRepldexUser) { // the user has a repldex account, create a new session for them sessionId = await createSession({