mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
add missing files pepega
This commit is contained in:
parent
8ba8bbeef6
commit
b872f83c9e
2 changed files with 59 additions and 0 deletions
40
src/common/Env.cpp
Normal file
40
src/common/Env.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
#include "common/Env.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
namespace {
|
||||
|
||||
QString readStringEnv(const char *envName, QString defaultValue)
|
||||
{
|
||||
auto envString = std::getenv(envName);
|
||||
if (envString != nullptr)
|
||||
{
|
||||
return QString(envString);
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Env::Env()
|
||||
: recentMessagesApiUrl(
|
||||
readStringEnv("CHATTERINO2_RECENT_MESSAGES_URL",
|
||||
"https://recent-messages.robotty.de/api/v2/"
|
||||
"recent-messages/%1?clearchatToNotice=true"))
|
||||
, linkResolverUrl(readStringEnv(
|
||||
"CHATTERINO2_LINK_RESOLVER_URL",
|
||||
"https://braize.pajlada.com/chatterino/link_resolver/%1"))
|
||||
, twitchEmoteSetResolverUrl(readStringEnv(
|
||||
"CHATTERINO2_TWITCH_EMOTE_SET_RESOLVER_URL",
|
||||
"https://braize.pajlada.com/chatterino/twitchemotes/set/%1/"))
|
||||
{
|
||||
}
|
||||
|
||||
const Env &Env::get()
|
||||
{
|
||||
static Env instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
19
src/common/Env.hpp
Normal file
19
src/common/Env.hpp
Normal file
|
@ -0,0 +1,19 @@
|
|||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class Env
|
||||
{
|
||||
Env();
|
||||
|
||||
public:
|
||||
static const Env &get();
|
||||
|
||||
const QString recentMessagesApiUrl;
|
||||
const QString linkResolverUrl;
|
||||
const QString twitchEmoteSetResolverUrl;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
Loading…
Reference in a new issue