feat: add site configuration
Issue
The website provides a download page for ReVanced Manager. The API returns a list of tools. Because the API can be changed, the tool names can also be changed. The website would not know, which tool to provide as a download. In other words, the website is the end application that has to break agnostics, but can not as of now.
Solution
Add a configuration to the website. The configuration would specify, which tool to provide as a download, which support links to highlight and similar. In the scenario above, an example configuration could look like this:
{
"download": "revanced-manager"
}
The configuration would specify the tool named "revanced-manager" as a download. The name would be used to find the download link from the APIs response list of tools the following way:
api.tools[configuration.download].download
Additional context
- It may be useful, to add a frontend to the website, similarly to the API configuration in the same location as the API configuration, as the configuration is client side. This would also be useful, because if someone intends to change the API url, they might also need to update the websites configuration to match the API. For example the API might only include a tool named "some-tool", so as a download the website would provide the download link to "some-tool".
- Since the API configuration uses the API url specified in the
.envfile by default, the site configuration must also originate from the.envfile. At build time, the configuration can then be generated from the.envfile. In other words, the default values for the site configuration should not be hardcoded into the source code, just like the API url isn't.