Skip to content

Commit

Permalink
Update LS
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans committed May 30, 2022
1 parent a6a7a22 commit 4aad982
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ GITHUB_ID=
GITHUB_SECRET=
IPFS_IP=http://127.0.0.1:8080
IPFS_API=http://127.0.0.1:5001
REDIS_IP=127.0.0.1:6379
REDIS_IP=redis://127.0.0.1:6379
SIGNALFS_IP=http://0.0.0.0:8000
SIGNAL_MASTER=yoursecrethere
SIGNAL_HOST=localhost
Expand Down
2 changes: 1 addition & 1 deletion src/cache.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createClient } from 'redis';

export const CACHE = createClient({
url: process.env.REDIS_IP || '127.0.0.1:6379',
url: process.env.REDIS_IP || 'redis://127.0.0.1:6379',
});

(async () => {
Expand Down
13 changes: 11 additions & 2 deletions src/routes/api/domains/ls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@ import { generateSunflake } from 'sunflake';

import { DB } from '../../../database';
import { useAuth } from '../../../util/http/useAuth';
import { Poof } from '../../../util/sentry/sentryHandle';

export const generateSnowflake = generateSunflake();

function determineIfAuth(
toBeDetermined: Poof | string
): toBeDetermined is Poof {
return !!toBeDetermined['status'];
}

export const DomainLsRoute: FastifyPluginAsync = async (router, options) => {
router.get('/', async (_request, reply) => {
const authData = await useAuth(_request, reply);
const authData = (await useAuth(_request, reply)) as Poof | string;

if (typeof authData !== 'string') return reply.send(authData);
if (determineIfAuth(authData)) {
return reply.status(authData.status).send();
}

reply.send(
await DB.selectFrom('sites', '*', {
Expand Down

0 comments on commit 4aad982

Please sign in to comment.