This commit is contained in:
1 parent
d5022d2d59
commit
cd2394dd22
19 files changed
+1757
-32
No files matched your search
+4
-4
@@ -69,7 +69,7 @@ class McpService {
|
||||
this.connection = 'disabled';
|
||||
const agent = this.agent; this.agent = null;
|
||||
this.publish();
|
||||
await agent?.stop();
|
||||
await Promise.all([agent?.stop(), this.options.handlers?.dispose?.()]);
|
||||
}
|
||||
async retryRevocations() {
|
||||
const pending = this.store.value.revocations;
|
||||
@@ -139,17 +139,17 @@ class McpService {
|
||||
const resolved = await fs.realpath(directory);
|
||||
const stat = await fs.stat(resolved);
|
||||
if (!stat.isDirectory() || path.parse(resolved).root === resolved) throw new McpAccessError('PATH_NOT_GRANTED');
|
||||
if (!this.store.value.grants.some(grant => grant.path === resolved)) await this.store.save({ ...this.store.value, grants: [...this.store.value.grants, { id: randomUUID(), label: path.basename(resolved), path: resolved, readOnly: true }] });
|
||||
if (!this.store.value.grants.some(grant => grant.path === resolved)) await this.store.save({ ...this.store.value, grants: [...this.store.value.grants, { id: randomUUID(), label: path.basename(resolved), path: resolved, readOnly: true, allowTransfer: false }] });
|
||||
this.publish(); return this.state();
|
||||
});
|
||||
}
|
||||
updateGrant(id, remove, readOnly = true) {
|
||||
updateGrant(id, remove, readOnly = true, allowTransfer) {
|
||||
const generation = this.generation;
|
||||
return this.serialize(async () => {
|
||||
const wasActive = this.active;
|
||||
await this.disconnect();
|
||||
await this.store.markDisabled();
|
||||
const grants = this.store.value.grants.flatMap(grant => grant.id !== id ? [grant] : remove ? [] : [{ ...grant, readOnly }]);
|
||||
const grants = this.store.value.grants.flatMap(grant => grant.id !== id ? [grant] : remove ? [] : [{ ...grant, readOnly, ...(allowTransfer === undefined ? {} : { allowTransfer }) }]);
|
||||
await this.store.save({ ...this.store.value, grants });
|
||||
if (wasActive && generation === this.generation) { await this.store.clearDisabled(); this.connect(); }
|
||||
this.publish(); return this.state();
|
||||
|
||||
Reference in new issue
Block a user