mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-02 05:54:44 +00:00
feat(agent): integrate sandboxed bash tool and sandbox settings
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
TeamInfo,
|
||||
GetMeResponse,
|
||||
UserInfo,
|
||||
SandboxSettings,
|
||||
} from '@/dtos/team'
|
||||
|
||||
export class TeamService {
|
||||
@@ -202,6 +203,35 @@ export class TeamService {
|
||||
return updated.settings || {}
|
||||
}
|
||||
|
||||
async getSandboxSettings(teamId: string): Promise<SandboxSettings> {
|
||||
const sandbox = await prisma.sandbox.findUnique({
|
||||
where: { teamId },
|
||||
})
|
||||
return {
|
||||
allowedDomains: sandbox?.allowedDomains || [
|
||||
'github.com',
|
||||
'api.github.com',
|
||||
'raw.githubusercontent.com',
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
async updateSandboxSettings(teamId: string, settings: SandboxSettings): Promise<SandboxSettings> {
|
||||
const sandbox = await prisma.sandbox.upsert({
|
||||
where: { teamId },
|
||||
create: {
|
||||
teamId,
|
||||
allowedDomains: settings.allowedDomains,
|
||||
},
|
||||
update: {
|
||||
allowedDomains: settings.allowedDomains,
|
||||
},
|
||||
})
|
||||
return {
|
||||
allowedDomains: sandbox.allowedDomains,
|
||||
}
|
||||
}
|
||||
|
||||
async getSignupInfo() {
|
||||
const count = await prisma.user.count()
|
||||
const defaultTeam = await this.ensureDefaultTeam()
|
||||
|
||||
Reference in New Issue
Block a user