mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-14 16:51:15 +10:00
chore: prettier pass
This commit is contained in:
@ -7,7 +7,7 @@ export default defineEventHandler(async (h3) => {
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const enabledMechanisms: AuthMec[] = await applicationSettings.get(
|
||||
"enabledAuthencationMechanisms"
|
||||
"enabledAuthencationMechanisms",
|
||||
);
|
||||
|
||||
return enabledMechanisms;
|
||||
|
||||
@ -3,9 +3,7 @@ import prisma from "~/server/internal/db/database";
|
||||
import { handleFileUpload } from "~/server/internal/utils/handlefileupload";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const allowed = await aclManager.allowSystemACL(h3, [
|
||||
"game:image:new",
|
||||
]);
|
||||
const allowed = await aclManager.allowSystemACL(h3, ["game:image:new"]);
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const form = await readMultipartFormData(h3);
|
||||
|
||||
@ -3,9 +3,7 @@ import prisma from "~/server/internal/db/database";
|
||||
import libraryManager from "~/server/internal/library";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const allowed = await aclManager.allowSystemACL(h3, [
|
||||
"game:read",
|
||||
]);
|
||||
const allowed = await aclManager.allowSystemACL(h3, ["game:read"]);
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const query = getQuery(h3);
|
||||
|
||||
@ -2,9 +2,7 @@ import aclManager from "~/server/internal/acls";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const allowed = await aclManager.allowSystemACL(h3, [
|
||||
"game:update",
|
||||
]);
|
||||
const allowed = await aclManager.allowSystemACL(h3, ["game:update"]);
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const body = await readBody(h3);
|
||||
|
||||
@ -3,9 +3,7 @@ import prisma from "~/server/internal/db/database";
|
||||
import { handleFileUpload } from "~/server/internal/utils/handlefileupload";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const allowed = await aclManager.allowSystemACL(h3, [
|
||||
"game:update",
|
||||
]);
|
||||
const allowed = await aclManager.allowSystemACL(h3, ["game:update"]);
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const form = await readMultipartFormData(h3);
|
||||
|
||||
@ -2,9 +2,7 @@ import aclManager from "~/server/internal/acls";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const allowed = await aclManager.allowSystemACL(h3, [
|
||||
"game:version:delete",
|
||||
]);
|
||||
const allowed = await aclManager.allowSystemACL(h3, ["game:version:delete"]);
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const body = await readBody(h3);
|
||||
|
||||
@ -2,9 +2,7 @@ import aclManager from "~/server/internal/acls";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const allowed = await aclManager.allowSystemACL(h3, [
|
||||
"game:version:update",
|
||||
]);
|
||||
const allowed = await aclManager.allowSystemACL(h3, ["game:version:update"]);
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const body = await readBody(h3);
|
||||
@ -30,13 +28,13 @@ export default defineEventHandler(async (h3) => {
|
||||
versionIndex: versionIndex,
|
||||
},
|
||||
select: {
|
||||
versionIndex: true,
|
||||
versionName: true,
|
||||
platform: true,
|
||||
delta: true,
|
||||
}
|
||||
})
|
||||
)
|
||||
versionIndex: true,
|
||||
versionName: true,
|
||||
platform: true,
|
||||
delta: true,
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
return newVersions;
|
||||
|
||||
@ -2,9 +2,7 @@ import aclManager from "~/server/internal/acls";
|
||||
import libraryManager from "~/server/internal/library";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const allowed = await aclManager.allowSystemACL(h3, [
|
||||
"import:game:read",
|
||||
]);
|
||||
const allowed = await aclManager.allowSystemACL(h3, ["import:game:read"]);
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const unimportedGames = await libraryManager.fetchAllUnimportedGames();
|
||||
|
||||
@ -7,9 +7,7 @@ import type {
|
||||
} from "~/server/internal/metadata/types";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const allowed = await aclManager.allowSystemACL(h3, [
|
||||
"import:game:new",
|
||||
]);
|
||||
const allowed = await aclManager.allowSystemACL(h3, ["import:game:new"]);
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const body = await readBody(h3);
|
||||
@ -30,7 +28,6 @@ export default defineEventHandler(async (h3) => {
|
||||
statusMessage: "Invalid unimported game path",
|
||||
});
|
||||
|
||||
|
||||
if (!metadata || !metadata.id || !metadata.sourceId) {
|
||||
console.log(metadata);
|
||||
return await metadataHandler.createGameWithoutMetadata(path);
|
||||
|
||||
@ -2,9 +2,7 @@ import aclManager from "~/server/internal/acls";
|
||||
import metadataHandler from "~/server/internal/metadata";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const allowed = await aclManager.allowSystemACL(h3, [
|
||||
"import:game:read",
|
||||
]);
|
||||
const allowed = await aclManager.allowSystemACL(h3, ["import:game:read"]);
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const query = getQuery(h3);
|
||||
|
||||
@ -2,9 +2,7 @@ import aclManager from "~/server/internal/acls";
|
||||
import libraryManager from "~/server/internal/library";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const allowed = await aclManager.allowSystemACL(h3, [
|
||||
"import:version:read",
|
||||
]);
|
||||
const allowed = await aclManager.allowSystemACL(h3, ["import:version:read"]);
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const query = await getQuery(h3);
|
||||
@ -15,9 +13,8 @@ export default defineEventHandler(async (h3) => {
|
||||
statusMessage: "Missing id in request params",
|
||||
});
|
||||
|
||||
const unimportedVersions = await libraryManager.fetchUnimportedVersions(
|
||||
gameId
|
||||
);
|
||||
const unimportedVersions =
|
||||
await libraryManager.fetchUnimportedVersions(gameId);
|
||||
if (!unimportedVersions)
|
||||
throw createError({ statusCode: 400, statusMessage: "Invalid game ID" });
|
||||
|
||||
|
||||
@ -4,9 +4,7 @@ import libraryManager from "~/server/internal/library";
|
||||
import { parsePlatform } from "~/server/internal/utils/parseplatform";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const allowed = await aclManager.allowSystemACL(h3, [
|
||||
"import:version:new",
|
||||
]);
|
||||
const allowed = await aclManager.allowSystemACL(h3, ["import:version:new"]);
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const body = await readBody(h3);
|
||||
|
||||
@ -2,9 +2,7 @@ import aclManager from "~/server/internal/acls";
|
||||
import libraryManager from "~/server/internal/library";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const allowed = await aclManager.allowSystemACL(h3, [
|
||||
"import:version:read",
|
||||
]);
|
||||
const allowed = await aclManager.allowSystemACL(h3, ["import:version:read"]);
|
||||
if (!allowed) throw createError({ statusCode: 403 });
|
||||
|
||||
const query = await getQuery(h3);
|
||||
@ -18,7 +16,7 @@ export default defineEventHandler(async (h3) => {
|
||||
|
||||
const preload = await libraryManager.fetchUnimportedVersionInformation(
|
||||
gameId,
|
||||
versionName
|
||||
versionName,
|
||||
);
|
||||
if (!preload)
|
||||
throw createError({
|
||||
|
||||
@ -19,4 +19,4 @@ export default defineEventHandler(async (h3) => {
|
||||
|
||||
await newsManager.delete(id);
|
||||
return { success: true };
|
||||
});
|
||||
});
|
||||
|
||||
@ -27,8 +27,7 @@ export default defineEventHandler(async (h3) => {
|
||||
take: parseInt(query.limit as string),
|
||||
skip: parseInt(query.skip as string),
|
||||
orderBy: orderBy,
|
||||
...(tags && { tags: tags
|
||||
.map((e) => e.toString()) }),
|
||||
...(tags && { tags: tags.map((e) => e.toString()) }),
|
||||
search: query.search as string,
|
||||
};
|
||||
|
||||
|
||||
@ -13,9 +13,9 @@ export default defineEventHandler(async (h3) => {
|
||||
authMecs: {
|
||||
select: {
|
||||
mec: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return users;
|
||||
|
||||
@ -31,7 +31,7 @@ export default defineEventHandler(async (h3) => {
|
||||
const certificateAuthority = useCertificateAuthority();
|
||||
const bundle = await certificateAuthority.generateClientCertificate(
|
||||
clientId,
|
||||
metadata.data.name
|
||||
metadata.data.name,
|
||||
);
|
||||
|
||||
const client = await clientHandler.finialiseClient(clientId);
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import type {
|
||||
InternalClientCapability} from "~/server/internal/clients/capabilities";
|
||||
import type { InternalClientCapability } from "~/server/internal/clients/capabilities";
|
||||
import capabilityManager, {
|
||||
validCapabilities,
|
||||
} from "~/server/internal/clients/capabilities";
|
||||
@ -34,7 +33,7 @@ export default defineClientEventHandler(
|
||||
|
||||
const isValid = await capabilityManager.validateCapabilityConfiguration(
|
||||
capability,
|
||||
configuration
|
||||
configuration,
|
||||
);
|
||||
if (!isValid)
|
||||
throw createError({
|
||||
@ -45,7 +44,7 @@ export default defineClientEventHandler(
|
||||
await capabilityManager.upsertClientCapability(
|
||||
capability,
|
||||
configuration,
|
||||
clientId
|
||||
clientId,
|
||||
);
|
||||
|
||||
const client = await fetchClient();
|
||||
@ -59,5 +58,5 @@ export default defineClientEventHandler(
|
||||
});
|
||||
|
||||
return {};
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@ -49,5 +49,5 @@ export default defineClientEventHandler(
|
||||
});
|
||||
if (!save)
|
||||
throw createError({ statusCode: 404, statusMessage: "Save not found" });
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@ -51,5 +51,5 @@ export default defineClientEventHandler(
|
||||
throw createError({ statusCode: 404, statusMessage: "Save not found" });
|
||||
|
||||
return save;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@ -44,9 +44,9 @@ export default defineClientEventHandler(
|
||||
user.id,
|
||||
slotIndex,
|
||||
h3.node.req,
|
||||
client.id
|
||||
client.id,
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@ -33,5 +33,5 @@ export default defineClientEventHandler(
|
||||
});
|
||||
|
||||
return saves;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@ -58,5 +58,5 @@ export default defineClientEventHandler(
|
||||
});
|
||||
|
||||
return newSlot;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@ -19,5 +19,5 @@ export default defineClientEventHandler(
|
||||
});
|
||||
|
||||
return saves;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@ -27,5 +27,5 @@ export default defineClientEventHandler(
|
||||
});
|
||||
|
||||
return token.token;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@ -23,7 +23,7 @@ export default defineEventHandler(async (h3) => {
|
||||
const successful = await userLibraryManager.collectionRemove(
|
||||
gameId,
|
||||
id,
|
||||
userId
|
||||
userId,
|
||||
);
|
||||
if (!successful)
|
||||
throw createError({
|
||||
|
||||
@ -7,7 +7,7 @@ export default defineEventHandler(async (h3) => {
|
||||
throw createError({
|
||||
statusCode: 403,
|
||||
});
|
||||
|
||||
|
||||
const collections = await userLibraryManager.fetchCollections(userId);
|
||||
return collections;
|
||||
});
|
||||
|
||||
@ -16,7 +16,6 @@ export default defineEventHandler(async (h3) => {
|
||||
statusCode: 400,
|
||||
message: "Missing news ID",
|
||||
});
|
||||
|
||||
|
||||
const news = await newsManager.fetchById(id);
|
||||
if (!news)
|
||||
@ -25,6 +24,5 @@ export default defineEventHandler(async (h3) => {
|
||||
message: "News article not found",
|
||||
});
|
||||
|
||||
|
||||
return news;
|
||||
});
|
||||
|
||||
@ -9,7 +9,7 @@ export default defineEventHandler(async (h3) => {
|
||||
const hasSystemPerms = await aclManager.allowSystemACL(h3, [
|
||||
"notifications:mark",
|
||||
]);
|
||||
if(hasSystemPerms){
|
||||
if (hasSystemPerms) {
|
||||
userIds.push("system");
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ export default defineEventHandler(async (h3) => {
|
||||
setHeader(
|
||||
h3,
|
||||
"Cache-Control",
|
||||
"private, max-age=31536000, s-maxage=31536000, immutable"
|
||||
"private, max-age=31536000, s-maxage=31536000, immutable",
|
||||
);
|
||||
return object.data;
|
||||
});
|
||||
|
||||
@ -18,7 +18,7 @@ export default defineEventHandler(async (h3) => {
|
||||
const result = await objectHandler.writeWithPermissions(
|
||||
id,
|
||||
async () => buffer,
|
||||
userId
|
||||
userId,
|
||||
);
|
||||
return { success: result };
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user