Skip to content

Refactor updateBlacklist to Support Pluggable Storage Backends #908

@Blumlaut

Description

@Blumlaut

updateBlacklist is frankly a mess and needs an entire rewrite, we could use this chance to support multiple storage backends again, here's an idea how we could achieve this:

Split up updateBlacklist, currently it takes care of 5 or 6 different functions, this is horrible.
we should break it up into multiple functions, something like this:

Storage.addBan
Storage.removeBan
Storage.get(ban) -- maybe no-arg for entire banlist?
Storage.set(ban, data)

Introduce a Storage interface (table with functions) with methods like:

Storage = {
  get = function() end,
  set = function(ban, data) end,
  addBan = function(ban) end,
  removeBan = function(banid?) end,
  apiVersion = 1 -- possibly have an incrementing number for future features which may use the storage as well?
}

This could then be handled the same way as existing plugins, see https://github.com/Blumlaut/EasyAdmin/blob/master/client/plugins.lua

Open to suggestions on how to achieve this, this is just a small draft, i haven't actually looked at the code in years.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions