arvinxx / umi-plugin-extensions

用于开发 Chrome 插件的 umi 适配插件
https://umi-plugin-extensions.vercel.app
MIT License
45 stars 7 forks source link

🐛[BUG] manifest permissions 不支持 string 类型 #18

Closed ppsite closed 3 years ago

ppsite commented 3 years ago

🐛 bug 描述

permissions: [
  "storage",
  "cookies",
  "https://*/*",
  "http://*/*"
],

这种情况下会报错:

ValidationError: "permissions[2]" must be one of [activeTab, alarms, background, bookmarks, browsingData, certificateProvider, clipboardRead, clipboardWrite, contentSettings, contextMenus, cookies, debugger, declarativeContent, declarativeNetRequest, declarativeNetRequestFeedback, declarativeWebRequest, desktopCapture, displaySource, dns, documentScan, downloads, enterprise.deviceAttributes, enterprise.hardwarePlatform, enterprise.networkingAttributes, enterprise.platformKeys, experimental, fileBrowserHandler, fileSystemProvider, fontSettings, gcm, geolocation, history, identity, idle, idltest, login, loginScreenStorage, loginState, management, nativeMessaging, notifications, pageCapture, platformKeys, power, printerProvider, printing, printingMetrics, privacy, processes, proxy, scripting, search, sessions, signedInDevices, storage, system.cpu, system.display, system.memory, system.storage, tabCapture, tabGroups, tabs, topSites, tts, ttsEngine, unlimitedStorage, vpnProvider, wallpaper, webNavigation, webRequest, webRequestBlocking]

🚑 源码分析

  1. 查看 Permissions 定义,说明是支持 string 类型的

    // types/Mainifest.ts
    export type Permissions = SpecialPermissions | KnownPermissions | string;
  2. 查看校验器

// src/functions/configSchema.ts
manifest 校验器中不支持其他类型

需求

对 umjs 不熟悉,有心无力,还请大神修复下校验器!

arvinxx commented 3 years ago

收到,正在修复

ppsite commented 3 years ago

666, 大佬速度呀!

我研究了下 Umijs Joi, 没搞明白怎么验证才能支持;

原来竟然这么解决;

👍;

大佬能否加个微信(hsdtsyl),想跟你学学!

arvinxx commented 3 years ago

有点问题,我可能还要发个版。等 0.3.5

arvinxx commented 3 years ago

https://github.com/arvinxx/umi-plugin-extensions/releases/tag/v0.3.5 已修复