archivebox-browser-extension icon indicating copy to clipboard operation
archivebox-browser-extension copied to clipboard

Make configuration more reactive and unified

Open tjhorner opened this issue 3 years ago • 0 comments

Right now there's lots of manual binding to config changes in the frontend, which can result in really unmaintainable code. The "Archive Mode" setting is also a special case right now which makes it difficult to deal with. The goal here should be a unified config system with one ConfigField component that adapts to the type of value.

The config schema should also be defined in one place, specifying all the related metadata for each option, e.g.

[
  {
    "key": "archiveMode",
    "name": "Archive Mode",
    "type": "option",
    "default": "allowlist",
    "options": [
      {
        "id": "allowlist",
        "name": "Allowlist (don't archive by default)"
      },
      {
        "id": "blocklist",
        "name": "Blocklist (archive by default)"
      }
    ]
  },
  {
    "key": "baseUrl",
    "name": "ArchiveBox Base URL",
    "type": "text",
    "default": "",
    "placeholder": "https://example.com"
  },
  // and so on
]

tjhorner avatar Jul 02 '21 11:07 tjhorner