File tree Expand file tree Collapse file tree 4 files changed +31
-40
lines changed
Expand file tree Collapse file tree 4 files changed +31
-40
lines changed Original file line number Diff line number Diff line change @@ -267,6 +267,10 @@ and have curl use certificate pinning
267267 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);
268268 curl_easy_setopt(curl, CURLOPT_PINNEDPUBLICKEY, "sha256//base64_encoded_hash_here"); // Pin the public key
269269
270+ One way to get the base64 hash sum
271+ openssl s_client -connect trle.net:443 -servername trle.net < /dev/null | openssl x509 -pubkey -noout > pubkey.pem
272+ openssl pkey -pubin -inform PEM -in pubkey.pem -outform DER | sha256sum | xxd -r -p | base64
273+
270274and make sure the index database can't every change the host name,
271275unless someone use a quantum computer or specialized illegal hardware, it could
272276be difficult to tampered with the download of files. We must make sure we install
Original file line number Diff line number Diff line change @@ -161,6 +161,7 @@ class Data : public QObject {
161161
162162 public:
163163 static Data& getInstance () {
164+ // cppcheck-suppress threadsafety-threadsafety
164165 static Data instance;
165166 return instance;
166167 }
Original file line number Diff line number Diff line change @@ -184,10 +184,11 @@ void TombRaiderLinuxLauncher::generateList() {
184184 }
185185 }
186186
187- auto & mapType = StaticType::getMap ();
188- auto & mapClass = StaticClass::getMap ();
189- auto & mapDifficulty = StaticDifficulty::getMap ();
190- auto & mapDuration = StaticDuration::getMap ();
187+ StaticData staticData;
188+ auto mapType = staticData.getType ();
189+ auto mapClass = staticData.getClass ();
190+ auto mapDifficulty = staticData.getDifficulty ();
191+ auto mapDuration = staticData.getDuration ();
191192
192193 QVector<ListItemData> list;
193194 controller.getList (&list);
Original file line number Diff line number Diff line change 1616#include < QString>
1717#include < unordered_map>
1818
19- class StaticClass {
20- public:
21- static const std::unordered_map<qint64, QString>& getMap () {
22- static const std::unordered_map<qint64, QString> idToString = {
19+ struct StaticData {
20+ std::unordered_map<qint64, QString> getDifficulty () const {
21+ return {
22+ {0 , " null" },
23+ {1 , " easy" },
24+ {2 , " medium" },
25+ {3 , " challenging" },
26+ {4 , " very challenging" }
27+ };
28+ }
29+ std::unordered_map<qint64, QString> getClass () const {
30+ return {
31+ {0 , " null" },
2332 {1 , " Alien/Space" },
2433 {2 , " Atlantis" },
2534 {3 , " Base/Lab" },
@@ -58,50 +67,26 @@ class StaticClass {
5867 {36 , " Xmas" },
5968 {36 , " Young Lara" }
6069 };
61- return idToString;
6270 }
63- };
64-
65- class StaticDifficulty {
66- public:
67- static const std::unordered_map<qint64, QString>& getMap () {
68- static const std::unordered_map<qint64, QString> idToString = {
71+ std::unordered_map<qint64, QString> getDuration () const {
72+ return {
6973 {0 , " null" },
70- {1 , " easy " },
74+ {1 , " short " },
7175 {2 , " medium" },
72- {3 , " challenging " },
73- {4 , " very challenging " }
76+ {3 , " long " },
77+ {4 , " very long " }
7478 };
75- return idToString;
7679 }
77- };
78-
79- class StaticType {
80- public:
81- static const std::unordered_map<qint64, QString>& getMap () {
82- static const std::unordered_map<qint64, QString> idToString = {
80+ std::unordered_map<qint64, QString> getType () const {
81+ return {
82+ {0 , " null" },
8383 {1 , " TR1" },
8484 {2 , " TR2" },
8585 {3 , " TR3" },
8686 {4 , " TR4" },
8787 {5 , " TR5" },
8888 {6 , " TEN" }
8989 };
90- return idToString;
91- }
92- };
93-
94- class StaticDuration {
95- public:
96- static const std::unordered_map<qint64, QString>& getMap () {
97- static const std::unordered_map<qint64, QString> idToString = {
98- {0 , " null" },
99- {1 , " short" },
100- {2 , " medium" },
101- {3 , " long" },
102- {4 , " very long" }
103- };
104- return idToString;
10590 }
10691};
10792
You can’t perform that action at this time.
0 commit comments