Skip to content

Commit f3e63b7

Browse files
committed
DiscordCoreAPI Release v1.50
-Implemented a new MessagePrinter class for handling access to std::cout and std::cerr. -Switched to using a thread-local instance of JsonifierCore. -Modified the TCPConnection and related classes to no longer use exceptions, instead returning error codes. -Moved a bunch of the utilities into their own headers, to be inlined. -Refactored the Https subsystem, as well as its ratelimiting system. -Improved the exception structures. -Improved the connection logic of the WebSocketSSLClients. -Implemented new relational operators. -Removed a bunch of superfluous operators. -Implemented a timeout for CoRoutines. -Implemented a UniquePtr class to improve handling of the Deleter class. -Modified the CoRoutineThreadPool class. -Refactored the SongAPI class.
1 parent 3eca695 commit f3e63b7

File tree

281 files changed

+5162
-5424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+5162
-5424
lines changed

.clang-format

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,63 @@
1-
---
1+
# Format Style Options - Created with Clang Power Tools
2+
---
23
AlignAfterOpenBracket: DontAlign
3-
AlignConsecutiveMacros: 'false'
4-
AlignConsecutiveAssignments: 'false'
5-
AlignConsecutiveDeclarations: 'false'
4+
AlignConsecutiveAssignments: false
5+
AlignConsecutiveDeclarations: false
6+
AlignConsecutiveMacros: false
67
AlignEscapedNewlines: DontAlign
7-
AlignOperands: 'false'
8-
AlignTrailingComments: 'false'
9-
AllowAllArgumentsOnNextLine: 'false'
10-
AllowAllConstructorInitializersOnNextLine: 'false'
11-
AllowAllParametersOfDeclarationOnNextLine: 'false'
12-
AllowShortBlocksOnASingleLine: 'false'
13-
AllowShortCaseLabelsOnASingleLine: 'false'
8+
AlignOperands: false
9+
AlignTrailingComments: false
10+
AllowAllArgumentsOnNextLine: false
11+
AllowAllConstructorInitializersOnNextLine: false
12+
AllowAllParametersOfDeclarationOnNextLine: false
13+
AllowShortBlocksOnASingleLine: false
14+
AllowShortCaseLabelsOnASingleLine: false
15+
AllowShortLambdasOnASingleLine: None
1416
AllowShortFunctionsOnASingleLine: None
1517
AllowShortIfStatementsOnASingleLine: Never
16-
AllowShortLambdasOnASingleLine: None
17-
AllowShortLoopsOnASingleLine: 'false'
18+
AllowShortLoopsOnASingleLine: false
1819
AlwaysBreakAfterDefinitionReturnType: None
1920
AlwaysBreakAfterReturnType: None
20-
AlwaysBreakTemplateDeclarations: 'No'
21-
ColumnLimit: '150'
22-
CompactNamespaces: 'false'
23-
ConstructorInitializerIndentWidth: '4'
24-
ContinuationIndentWidth: '4'
25-
Cpp11BracedListStyle: 'false'
26-
FixNamespaceComments: 'false'
27-
IndentCaseLabels: 'true'
21+
AlwaysBreakTemplateDeclarations: No
22+
ColumnLimit: 150
23+
CompactNamespaces: false
24+
ConstructorInitializerIndentWidth : 4
25+
ContinuationIndentWidth: 4
26+
Cpp11BracedListStyle: false
27+
FixNamespaceComments: false
28+
IndentCaseLabels: true
2829
IndentPPDirectives: BeforeHash
29-
IndentWidth: '4'
30-
IndentWrappedFunctionNames: 'false'
31-
KeepEmptyLinesAtTheStartOfBlocks: 'false'
30+
IndentWidth: 4
31+
IndentWrappedFunctionNames: false
32+
KeepEmptyLinesAtTheStartOfBlocks: false
3233
Language: Cpp
33-
MaxEmptyLinesToKeep: '4'
34+
MaxEmptyLinesToKeep: 4
3435
NamespaceIndentation: All
3536
ObjCBinPackProtocolList: Auto
36-
ObjCBlockIndentWidth: '4'
37-
ObjCSpaceAfterProperty: 'false'
38-
ObjCSpaceBeforeProtocolList: 'true'
37+
ObjCBlockIndentWidth: 4
38+
ObjCSpaceAfterProperty: false
39+
ObjCSpaceBeforeProtocolList: true
3940
PointerAlignment: Left
40-
ReflowComments: 'false'
41-
SortIncludes: 'false'
42-
SortUsingDeclarations: 'false'
43-
SpaceAfterCStyleCast: 'false'
44-
SpaceAfterLogicalNot: 'false'
45-
SpaceAfterTemplateKeyword: 'false'
46-
SpaceBeforeAssignmentOperators: 'true'
47-
SpaceBeforeCpp11BracedList: 'false'
48-
SpaceBeforeCtorInitializerColon: 'true'
49-
SpaceBeforeInheritanceColon: 'true'
41+
ReflowComments: false
42+
SortIncludes: false
43+
SortUsingDeclarations: false
44+
SpaceAfterCStyleCast: false
45+
SpaceAfterLogicalNot: false
46+
SpaceAfterTemplateKeyword: false
47+
SpaceBeforeAssignmentOperators: true
48+
SpaceBeforeCpp11BracedList: false
49+
SpaceBeforeCtorInitializerColon: true
50+
SpaceBeforeInheritanceColon: true
5051
SpaceBeforeParens: ControlStatements
51-
SpaceBeforeRangeBasedForLoopColon: 'false'
52-
SpaceInEmptyParentheses: 'false'
53-
SpacesBeforeTrailingComments: '0'
54-
SpacesInAngles: 'false'
55-
SpacesInCStyleCastParentheses: 'true'
56-
SpacesInContainerLiterals: 'true'
57-
SpacesInParentheses: 'false'
58-
SpacesInSquareBrackets: 'false'
52+
SpaceBeforeRangeBasedForLoopColon: false
53+
SpaceInEmptyParentheses: false
54+
SpacesBeforeTrailingComments: 0
55+
SpacesInAngles: false
56+
SpacesInContainerLiterals: true
57+
SpacesInCStyleCastParentheses: true
58+
SpacesInParentheses: false
59+
SpacesInSquareBrackets: false
5960
Standard: Cpp11
60-
TabWidth: '4'
61+
TabWidth: 4
6162
UseTab: Always
62-
6363
...

BuildTools/Classes/Packager/Vcpkg.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function checkoutRepository(string $tag = ""): bool
109109
chdir(getenv('HOME'));
110110
system('rm -rf ./discordcoreapi');
111111
$this->git('config --global user.email "[email protected]"');
112-
$this->git('config --global user.name "realtimechris"');
112+
$this->git('config --global user.name "RealTimeChris"');
113113
$this->git('clone ' . escapeshellarg($repositoryUrl) . ' ./discordcoreapi --depth=1');
114114

115115
/* This is noisy, silence it */
@@ -133,8 +133,7 @@ function constructPortAndVersionFile(string $sha512 = "0"): string
133133
{
134134
echo GREEN . "Construct portfile for " . $this->getVersion() . ", sha512: $sha512\n" . WHITE;
135135
chdir(getenv("HOME") . '/discordcoreapi');
136-
$date=date_create();
137-
;
136+
138137
$portFileContent = 'if(VCPKG_TARGET_IS_LINUX)
139138
message(WARNING "DiscordCoreAPI only supports g++ 11 on linux.")
140139
endif()
@@ -144,6 +143,7 @@ function constructPortAndVersionFile(string $sha512 = "0"): string
144143
REPO RealTimeChris/DiscordCoreAPI
145144
REF "v${VERSION}"
146145
SHA512 ' . $sha512 . '
146+
HEAD_REF main
147147
)
148148
149149
vcpkg_cmake_configure(
@@ -188,9 +188,7 @@ function constructPortAndVersionFile(string $sha512 = "0"): string
188188
"host": true
189189
}
190190
]
191-
}
192-
193-
';
191+
}';
194192
echo GREEN . "Writing portfile...\n" . WHITE;
195193
file_put_contents('./Vcpkg/ports/discordcoreapi/vcpkg.json', $versionFileContent);
196194
return $portFileContent;
@@ -257,16 +255,17 @@ function secondBuild(string $portFileContent): bool
257255
$this->sudo('./vcpkg format-manifest ./ports/discordcoreapi/vcpkg.json');
258256
/* Note: We commit this in /usr/local, but we never push it (we can't) */
259257
$this->git('add .', true);
260-
$this->git('commit -m "[bot] VCPKG info update"', true);
258+
$this->git('commit -m "VCPKG info update"', true);
261259
$this->sudo('/usr/local/share/vcpkg/vcpkg x-add-version discordcoreapi');
262260

263261
echo GREEN . "Copy back port files from /usr/local/share...\n" . WHITE;
264262
chdir(getenv('HOME') . '/discordcoreapi');
263+
system('cp -v -R /usr/local/share/vcpkg/ports/discordcoreapi/vcpkg.json ./Vcpkg/ports/discordcoreapi/vcpkg.json');
265264
system('cp -v -R /usr/local/share/vcpkg/versions/d-/discordcoreapi.json ./Vcpkg/versions/d-/discordcoreapi.json');
266265

267266
echo GREEN . "Commit and push changes to main branch\n" . WHITE;
268267
$this->git('add .');
269-
$this->git('commit -m "[bot] VCPKG info update [skip ci]"');
268+
$this->git('commit -m "VCPKG info update [skip ci]"');
270269
$this->git('config pull.rebase false');
271270
$this->git('pull');
272271
$this->git('push origin main');

BuildTools/make_vcpkg.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Automatic CI process for generating new vcpkg releases.
55
* Based loosely on RealTimeChris's shell script version.
66
*
7-
* This updates the content of ./vcpkg directory within the DiscordCoreAPI
7+
* This updates the content of ./Vcpkg directory within the DiscordCoreAPI
88
* repository on the main branch, which can then be diffed into
99
* the microsoft/vcpkg main branch to build a PR for the new
1010
* release.
@@ -46,6 +46,7 @@
4646
if (!$vcpkg->checkoutRepository()) {
4747
exit(1);
4848
}
49+
4950
/* Attempt second build with the valid SHA512 sum. Program exit
5051
* status is the exit status of `vcpkg install`
5152
*/

CMakeLists.txt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@
2121
# CMakeLists.txt - The CMake script for building this library.
2222
# May 13, 2021
2323
# https://discordcoreapi.com
24-
set(VCPKG_ROOT_DIR "C:/vcpkg")
24+
set(VCPKG_ROOT_DIR "/home/chris/Vcpkg")
2525
set(Opus_DIR "C:/Vcpkg/installed/x64-windows/share/opus") # Set this one to the folder location of the file "OpusConfig.cmake".
2626
set(unofficial-sodium_DIR "C:/Vcpkg/installed/x64-windows/share/unofficial-sodium") # Set this one to the folder location of the file "unofficial-sodiumConfig.cmake".
27-
set(Jsonifier_DIR "C:/Vcpkg/installed/x64-windows/share/jsonifier") # Set this one to the folder location of the file "JsonifierConfig.cmake".
27+
set(Jsonifier_DIR "C:/Users/Chris/source/repos/Jsonifier/Install/Windows-Debug/share/jsonifier/") # Set this one to the folder location of the file "JsonifierConfig.cmake".
2828
set(OPENSSL_ROOT_DIR "C:/Vcpkg/installed/x64-windows/") # Set this one to the folder location of the include folder and library folders of OpenSSL.
2929

30+
if (EXISTS "${VCPKG_ROOT_DIR}")
31+
set(ENV{VCPKG_INSTALLATION_ROOT "${VCPKG_ROOT_DIR}")
32+
endif()
33+
3034
cmake_minimum_required(VERSION 3.20)
3135
if (WIN32)
3236
set(OS "windows")
@@ -43,6 +47,10 @@ if (NOT "$ENV{VCPKG_INSTALLATION_ROOT}" STREQUAL "")
4347
set(Opus_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/share/opus")
4448
set(unofficial-sodium_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/share/unofficial-sodium")
4549
include("${VCPKG_INSTALLATION_ROOT_NEW}/scripts/buildsystems/vcpkg.cmake")
50+
set(OS_NAME "${CMAKE_SYSTEM_NAME}")
51+
string(TOLOWER "${OS_NAME}" OS_NAME)
52+
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}")
53+
set(DEBUG_PREFIX "")
4654
else()
4755
message(WARNING "No Vcpkg root folder found, Please make sure that you properly set the library folders.")
4856
set(VCPKG_INSTALLATION_ROOT_NEW "${VCPKG_ROOT_DIR}")
@@ -64,11 +72,4 @@ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/CMake;")
6472
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE}")
6573
set(CMAKE_CXX_STANDARD 23)
6674

67-
if(EXISTS "${_VCPKG_INSTALLED_DIR}")
68-
set(OS_NAME "${CMAKE_SYSTEM_NAME}")
69-
string(TOLOWER "${OS_NAME}" OS_NAME)
70-
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}")
71-
set(DEBUG_PREFIX "")
72-
endif()
73-
7475
add_subdirectory(Library)

CMakePresets.json

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
"rhs": "Windows",
99
"type": "equals"
1010
},
11-
"installDir": "${sourceDir}/Install/${presetName}",
1211
"description": "Target Windows with the Visual Studio development environment.",
12+
"generator": "Visual Studio 17 2022",
1313
"hidden": true,
14+
"installDir": "${sourceDir}/Install/${presetName}",
1415
"name": "Windows-Base"
1516
},
1617
{
@@ -25,10 +26,13 @@
2526
},
2627
{
2728
"architecture": {
28-
"value": "x64",
29-
"strategy": "external"
29+
"strategy": "external",
30+
"value": "x64"
31+
},
32+
"cacheVariables": {
33+
"CMAKE_BUILD_TYPE": "Release",
34+
"DEV": true
3035
},
31-
"cacheVariables": { "CMAKE_BUILD_TYPE": "Release", "DEV": true },
3236
"description": "Target Windows (64-bit) with the Visual Studio development environment. (Release)",
3337
"inherits": "Windows-Base",
3438
"name": "Windows-Release-Dev"
@@ -45,10 +49,13 @@
4549
},
4650
{
4751
"architecture": {
48-
"value": "x64",
49-
"strategy": "external"
52+
"strategy": "external",
53+
"value": "x64"
54+
},
55+
"cacheVariables": {
56+
"CMAKE_BUILD_TYPE": "Debug",
57+
"DEV": true
5058
},
51-
"cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", "DEV": true },
5259
"description": "Target Windows (64-bit) with the Visual Studio development environment. (Debug)",
5360
"inherits": "Windows-Base",
5461
"name": "Windows-Debug-Dev"
@@ -60,7 +67,8 @@
6067
},
6168
"cacheVariables": {
6269
"ASAN_ENABLED": "TRUE",
63-
"CMAKE_BUILD_TYPE": "Release"
70+
"CMAKE_BUILD_TYPE": "Release",
71+
"DEV": true
6472
},
6573
"description": "Target Windows (64-bit) with the Visual Studio development environment. (Release)",
6674
"inherits": "Windows-Base",
@@ -73,7 +81,8 @@
7381
},
7482
"cacheVariables": {
7583
"ASAN_ENABLED": "TRUE",
76-
"CMAKE_BUILD_TYPE": "Debug"
84+
"CMAKE_BUILD_TYPE": "Debug",
85+
"DEV": true
7786
},
7887
"description": "Target Windows (64-bit) with the Visual Studio development environment. (Debug)",
7988
"inherits": "Windows-Base",
@@ -167,6 +176,20 @@
167176
"name": "Windows-Debug-Asan",
168177
"verbose": true
169178
},
179+
{
180+
"configurePreset": "Windows-Release-Dev",
181+
"inheritConfigureEnvironment": true,
182+
"configuration": "Release",
183+
"name": "Windows-Release-Dev",
184+
"verbose": true
185+
},
186+
{
187+
"configurePreset": "Windows-Debug-Dev",
188+
"inheritConfigureEnvironment": true,
189+
"configuration": "Debug",
190+
"name": "Windows-Debug-Dev",
191+
"verbose": true
192+
},
170193
{
171194
"configurePreset": "Linux-Release",
172195
"inheritConfigureEnvironment": true,

0 commit comments

Comments
 (0)