Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix URLS in the cache file #75

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Components/Modules/Changelog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Components
std::lock_guard _(Mutex);
Lines.clear();

const auto data = Utils::Cache::GetFile("/develop/CHANGELOG.md");
const auto data = Utils::Cache::GetFile("/iw4/data/CHANGELOG.md");

if (data.empty())
{
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Modules/News.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace Components

UIScript::Add("visitWebsite", []([[maybe_unused]] const UIScript::Token& token, [[maybe_unused]] const Game::uiInfo_s* info)
{
Utils::OpenUrl(Utils::Cache::GetUrl(Utils::Cache::Urls[1], {}));
Utils::OpenUrl("https://alterware.dev/");
});

Localization::Set("MPUI_CHANGELOG_TEXT", "Loading...");
Expand All @@ -75,7 +75,7 @@ namespace Components
Changelog::LoadChangelog();
if (Terminate) return;

const auto data = Utils::Cache::GetFile("/iw4/motd.txt");
const auto data = Utils::Cache::GetFile("/iw4/data/motd.txt");
if (!data.empty())
{
Localization::Set("MPUI_MOTD_TEXT", data);
Expand Down
3 changes: 1 addition & 2 deletions src/Utils/Cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ namespace Utils
{
const char* Cache::Urls[] =
{
"https://raw.githubusercontent.com/diamante0018/iw4x-client",
"https://alterware.dev",
"https://master.alterware.dev",
};

std::string Cache::ValidUrl;
Expand Down
3 changes: 1 addition & 2 deletions src/Utils/Cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ namespace Utils
class Cache
{
public:
static const char* Urls[];

static std::string GetUrl(const std::string& url, const std::string& path);
static std::string GetFile(const std::string& path, int timeout = 5000, const std::string& useragent = "IW4x");

private:
static const char* Urls[];
static std::mutex CacheMutex;
static std::string ValidUrl;
};
Expand Down