Skip to content

[Feature] 单独设置inprivate模式是否启用 #628

Closed

Description

@shipship-ship

功能算是能实现,但是每次重新打开浏览器都会重置,我希望能单独设置每个插件是否启用,主要是适配一些免登录的插件,让它在登录的情况下不发挥作用,还有适配一些不登陆就会有bug的插件

Originally posted by @Lianoob in #571

Activity

  1. cyfung1031 commented on Aug 17, 2025

    @cyfung1031
    Collaborator

    ScriptCat 應該有實現 // @run-in incognito-tabs

    https://www.tampermonkey.net/documentation.php?locale=en#meta:run_in

    不過這種要手動加

  2. cyfung1031 commented on Aug 21, 2025

    @cyfung1031
    Collaborator

    @CodFrm 现在有没有方法像 exclude 一样,用户能在介面自订meta?
    这样的话,用户加 // @run-in incognito-tabs 就能解决

  3. CodFrm commented on Aug 22, 2025

    @CodFrm
    Member

    @cyfung1031 直接往selfMetedata里面增加就可以了

  4. cyfung1031 commented on Aug 22, 2025

    @cyfung1031
    Collaborator

    @cyfung1031 直接往selfMetedata里面增加就可以了

    selfMetedata? 如何

  5. CodFrm commented on Aug 22, 2025

    @CodFrm
    Member

    @cyfung1031 往selfMetadata添加对应的属性,在这里会自动将原本的metadata里的值替换为selfMetadata的

    ret.metadata[key] = ret.selfMetadata![key];

    设置 script.selfMetedata['run-in']= 自定义的值 ,然后触发脚本更新 (不过脚本猫还没实现run-in)

  6. cyfung1031 commented on Aug 22, 2025

    @cyfung1031
    Collaborator

    @cyfung1031 往selfMetadata添加对应的属性,在这里会自动将原本的metadata里的值替换为selfMetadata的

    scriptcat/src/app/service/service_worker/script.ts

    Line 336 in cbe880e

    ret.metadata[key] = ret.selfMetadata![key];
    设置 script.selfMetedata['run-in']= 自定义的值 ,然后触发脚本更新 (不过脚本猫还没实现run-in)

    我是指用戶介面如何操作加這些?

  7. cyfung1031 commented on Aug 22, 2025

    @cyfung1031
    Collaborator

    @cyfung1031 往selfMetadata添加对应的属性,在这里会自动将原本的metadata里的值替换为selfMetadata的

    scriptcat/src/app/service/service_worker/script.ts

    Line 336 in cbe880e

    ret.metadata[key] = ret.selfMetadata![key];
    设置 script.selfMetedata['run-in']= 自定义的值 ,然后触发脚本更新 (不过脚本猫还没实现run-in)

    那這個範例是什麼??
    example/run-in/run-in_incognito-tabs.js

    代碼也寫了

    Image
  8. CodFrm commented on Aug 22, 2025

    @CodFrm
    Member

    @cyfung1031 好吧,我记错了,有人PR过了

    不太明白你的意思,是如何设计,还是如何实现?

    设计的话,可能在设置的地方增加一个下拉框,显示@run-in的选项

    实现的话,增加一个API,类似之前的 excludeUrl ,更新selfMetada的内容

    async excludeUrl({ uuid, url, remove }: { uuid: string; url: string; remove: boolean }) {
    const script = await this.scriptDAO.get(uuid);
    if (!script) {
    throw new Error("script not found");
    }
    script.selfMetadata = script.selfMetadata || {};
    let excludes = script.selfMetadata.exclude || script.metadata.exclude || [];
    if (remove) {
    excludes = excludes.filter((item) => item !== url);
    } else {
    excludes.push(url);
    }
    script.selfMetadata.exclude = excludes;
    return this.scriptDAO
    .update(uuid, script)
    .then(() => {
    // 广播一下
    this.mq.publish<TInstallScript>("installScript", { script, update: true });
    return true;
    })
    .catch((e) => {
    this.logger.error("exclude url error", Logger.E(e));
    throw e;
    });
    }

  9. cyfung1031 commented on Aug 22, 2025

    @cyfung1031
    Collaborator

    不太明白你的意思,是如何设计,还是如何实现?

    怪不得你答的跟我问的是完全两回事
    你看错我问题了

    @CodFrm 》》》》》》现在有没有方法《《《《《《像 exclude 一样,用户能在介面自订meta?
    这样的话,用户加 // @run-in incognito-tabs 就能解决

    我觉得我的写法没有问题呀
    所以答案是没有吧

  10. CodFrm commented on Aug 23, 2025

    @CodFrm
    Member

    是的,没有,需要编写

  11. CodFrm commented on Sep 2, 2025

    @CodFrm
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions