Start work on versioning

This commit is contained in:
Rikko 2022-08-13 22:04:32 +05:30
parent a3e3e93033
commit a02fe8eaba
5 changed files with 28 additions and 17 deletions

View file

@ -1,7 +1,17 @@
{ {
"plugin_manager_url": "http://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugin_manager.py",
"versions": {
"0.1.0": {
"api_version": 7,
"commit_sha": "a98dacd",
"dependencies": [],
"released_on": "12-08-2022",
"md5sum": "6aa01d047b1e6805ab0e111a1da41727"
}
},
"categories": [ "categories": [
"http://github.com/bombsquad-community/plugin-manager/{content_type}/main/plugins/utilities.json", "http://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugins/utilities.json",
"http://github.com/bombsquad-community/plugin-manager/{content_type}/main/plugins/minigames.json", "http://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugins/minigames.json",
"http://github.com/bombsquad-community/plugin-manager/{content_type}/main/plugins/maps.json" "http://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugins/maps.json"
] ]
} }

View file

@ -21,7 +21,7 @@ _uiscale = ba.app.ui.uiscale
# XXX: Using https with `ba.open_url` seems to trigger a pop-up dialog box on Android currently (v1.7.6) # XXX: Using https with `ba.open_url` seems to trigger a pop-up dialog box on Android currently (v1.7.6)
# and won't open the actual URL in a web-browser. Let's fallback to http for now until this # and won't open the actual URL in a web-browser. Let's fallback to http for now until this
# gets resolved. # gets resolved.
INDEX_META = "http://github.com/bombsquad-community/plugin-manager/{content_type}/main/index.json" INDEX_META = "http://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/index.json"
HEADERS = { HEADERS = {
"User-Agent": _env["user_agent_string"], "User-Agent": _env["user_agent_string"],
} }
@ -31,11 +31,12 @@ REGEXP = {
"plugin_entry_points": re.compile(b"(ba_meta export plugin\n+class )(.*)\("), "plugin_entry_points": re.compile(b"(ba_meta export plugin\n+class )(.*)\("),
"minigames": re.compile(b"(ba_meta export game\n+class )(.*)\("), "minigames": re.compile(b"(ba_meta export game\n+class )(.*)\("),
} }
DEFAULT_TAG = "main"
VERSION = "0.1.1" VERSION = "0.1.0"
GITHUB_REPO_LINK = "http://github.com/bombsquad-community/plugin-manager/" GITHUB_REPO_LINK = "http://github.com/bombsquad-community/plugin-manager"
THIRD_PARTY_CATEGORY_URL = "http://github.com/{repository}/{content_type}/main/category.json" THIRD_PARTY_CATEGORY_URL = "http://github.com/{repository}/{content_type}/{tag}/category.json"
_CACHE = {} _CACHE = {}
@ -104,7 +105,7 @@ class Category:
async def fetch_metadata(self): async def fetch_metadata(self):
if self._metadata is None: if self._metadata is None:
request = urllib.request.Request( request = urllib.request.Request(
self.meta_url.format(content_type="raw"), self.meta_url.format(content_type="raw", tag=DEFAULT_TAG),
headers=self.request_headers, headers=self.request_headers,
) )
response = await async_send_network_request(request) response = await async_send_network_request(request)
@ -402,8 +403,8 @@ class Plugin:
self.name, self.info = plugin self.name, self.info = plugin
self.is_3rd_party = is_3rd_party self.is_3rd_party = is_3rd_party
self.install_path = os.path.join(PLUGIN_DIRECTORY, f"{self.name}.py") self.install_path = os.path.join(PLUGIN_DIRECTORY, f"{self.name}.py")
self.download_url = url.format(content_type="raw") self.download_url = url.format(content_type="raw", tag=DEFAULT_TAG)
self.view_url = url.format(content_type="blob") self.view_url = url.format(content_type="blob", tag=DEFAULT_TAG)
self._local_plugin = None self._local_plugin = None
def __repr__(self): def __repr__(self):
@ -674,7 +675,7 @@ class PluginManager:
global _INDEX global _INDEX
if not self._index: if not self._index:
request = urllib.request.Request( request = urllib.request.Request(
INDEX_META.format(content_type="raw"), INDEX_META.format(content_type="raw", tag=DEFAULT_TAG),
headers=self.request_headers, headers=self.request_headers,
) )
response = await async_send_network_request(request) response = await async_send_network_request(request)
@ -866,7 +867,7 @@ class PluginSourcesWindow(popup.PopupWindow):
async def add_source(self): async def add_source(self):
source = ba.textwidget(query=self._add_source_widget) source = ba.textwidget(query=self._add_source_widget)
meta_url = THIRD_PARTY_CATEGORY_URL.format(repository=source, content_type="raw") meta_url = THIRD_PARTY_CATEGORY_URL.format(repository=source, content_type="raw", tag=DEFAULT_TAG)
category = Category(meta_url, is_3rd_party=True) category = Category(meta_url, is_3rd_party=True)
if not await category.is_valid(): if not await category.is_valid():
ba.screenmessage("Enter a valid plugin source") ba.screenmessage("Enter a valid plugin source")
@ -876,13 +877,13 @@ class PluginSourcesWindow(popup.PopupWindow):
return return
ba.app.config["Community Plugin Manager"]["Custom Sources"].append(source) ba.app.config["Community Plugin Manager"]["Custom Sources"].append(source)
ba.app.config.commit() ba.app.config.commit()
ba.screenmessage("Plugin source added") ba.screenmessage("Plugin source added, refresh plugin list to see changes")
self.draw_sources() self.draw_sources()
def delete_selected_source(self): def delete_selected_source(self):
ba.app.config["Community Plugin Manager"]["Custom Sources"].remove(self.selected_source) ba.app.config["Community Plugin Manager"]["Custom Sources"].remove(self.selected_source)
ba.app.config.commit() ba.app.config.commit()
ba.screenmessage("Plugin source deleted") ba.screenmessage("Plugin source deleted, refresh plugin list to see changes")
self.draw_sources() self.draw_sources()
def _ok(self) -> None: def _ok(self) -> None:

View file

@ -1,6 +1,6 @@
{ {
"name": "Maps", "name": "Maps",
"description": "Maps", "description": "Maps",
"plugins_base_url": "http://github.com/bombsquad-community/plugin-manager/{content_type}/main/plugins/maps", "plugins_base_url": "http://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugins/maps",
"plugins": {} "plugins": {}
} }

View file

@ -1,7 +1,7 @@
{ {
"name": "Minigames", "name": "Minigames",
"description": "Minigames", "description": "Minigames",
"plugins_base_url": "http://github.com/bombsquad-community/plugin-manager/{content_type}/main/plugins/minigames", "plugins_base_url": "http://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugins/minigames",
"plugins": { "plugins": {
"alliance_elimination": { "alliance_elimination": {
"description": "Fight in groups of duo, trio, or more. Last remaining alive wins.", "description": "Fight in groups of duo, trio, or more. Last remaining alive wins.",

View file

@ -1,7 +1,7 @@
{ {
"name": "Utilities", "name": "Utilities",
"description": "Utilities", "description": "Utilities",
"plugins_base_url": "http://github.com/bombsquad-community/plugin-manager/{content_type}/main/plugins/utilities", "plugins_base_url": "http://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugins/utilities",
"plugins": { "plugins": {
"colorscheme": { "colorscheme": {
"description": "Create custom UI colorschemes!", "description": "Create custom UI colorschemes!",