MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / enableScript

Method enableScript

src/app/service/service_worker/script.ts:557–579  ·  view source on GitHub ↗
(param: { uuid: string; enable: boolean })

Source from the content-addressed store, hash-verified

555 }
556
557 async enableScript(param: { uuid: string; enable: boolean }) {
558 const { uuid, enable } = param;
559 const logger = this.logger.with({ uuid, enable });
560 const script = await this.scriptDAO.get(uuid);
561 if (!script) {
562 logger.error("script not found");
563 throw new Error("script not found");
564 }
565 return this.scriptDAO
566 .update(uuid, {
567 status: enable ? SCRIPT_STATUS_ENABLE : SCRIPT_STATUS_DISABLE,
568 updatetime: Date.now(),
569 })
570 .then(() => {
571 logger.info("enable success");
572 this.mq.publish<TEnableScript[]>("enableScripts", [{ uuid: uuid, enable: enable }]);
573 return {};
574 })
575 .catch((e) => {
576 logger.error("enable error", Logger.E(e));
577 throw e;
578 });
579 }
580
581 async enableScripts(param: { uuids: string[]; enable: boolean }) {
582 const { uuids, enable } = param;

Callers 1

syncOnceInternalMethod · 0.45

Calls 7

withMethod · 0.80
errorMethod · 0.80
EMethod · 0.80
getMethod · 0.65
updateMethod · 0.65
publishMethod · 0.65
infoMethod · 0.45

Tested by

no test coverage detected