improve launcher auth and remote connection feedback

This commit is contained in:
2026-07-10 15:09:46 +09:00
parent 8461adfb3d
commit e36b0ca528
12 changed files with 334 additions and 3 deletions
+22
View File
@@ -61,6 +61,10 @@ export class AppsService {
async getApps(accessToken?: string) {
const authUserId = await this.getAuthUserId(accessToken);
if (authUserId) {
await this.ensureDefaultAppViewPermissions(authUserId);
}
const apps = await this.prisma.launcherApp.findMany({
where: { isEnabled: true },
orderBy: [{ sortOrder: 'asc' }, { displayName: 'asc' }],
@@ -296,4 +300,22 @@ export class AppsService {
return Boolean(permission);
}
private async ensureDefaultAppViewPermissions(authUserId: string) {
const apps = await this.prisma.launcherApp.findMany({
where: { isEnabled: true },
select: { id: true },
});
if (!apps.length) return;
await this.prisma.launcherUserApp.createMany({
data: apps.map((app) => ({
authUserId,
appId: app.id,
canView: true,
canLaunch: false,
})),
skipDuplicates: true,
});
}
}