分类 默认分类 下的文章

assume webstorm program location /opt/webstorm

sudo vim /usr/share/applications/webstorm.desktop

type in

[Desktop Entry]
Name=webstorm
Comment=Run My Program
Exec=/opt/webstorm/bin/webstorm
Icon=/opt/webstorm/icon.png
Terminal=false
Type=Application
Categories=Utility;Application;

manifest.json

{
  "name": "__MSG_name__",
  "default_locale": "en",
  "version": "1.0.0",
  "manifest_version": 3,
  "description": "__MSG_description__",
  "background": {
    "service_worker": "background.js"
  },
  "permissions": [
    "declarativeNetRequest",
    "declarativeNetRequestWithHostAccess"
  ],
  "host_permissions": [
    "*://*/*"
  ]
}

background.js

// 生成动态规则函数
const createCspRule = (extensionId) => ({
  id: 1001,
  priority: 1001,
  action: {
    type: "modifyHeaders",
    responseHeaders: [
      {
        header: "Content-Security-Policy",
        operation: "set",
        value: `frame-ancestors 'self' chrome-extension://${extensionId}`
      },
      { header: "X-Frame-Options", operation: "remove" }
    ]
  },
  condition: {
    urlFilter: "|*://*/*",
    resourceTypes: ["sub_frame"]
  }
});

// 安装时更新规则
chrome.runtime.onInstalled.addListener(async () => {
  const extensionId = chrome.runtime.id;

  await chrome.declarativeNetRequest.updateDynamicRules({
    removeRuleIds: [1001],
    addRules: [createCspRule(extensionId)]
  });

  console.log('动态规则已更新,当前扩展ID:', extensionId);
});

删除tag

# 删除本地tag
git tag --delete tagName
# 删除远程tag
git push origin --delete tag tagName

删除分支

# 删除本地分支
git tag --delete branchName
# 删除远程分支
git push origin --delete  branchName