1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 05:57:45 +00:00
This commit is contained in:
Mordred Admin 2017-08-08 18:04:29 +02:00
commit 72a631a961
8 changed files with 191 additions and 1890 deletions

93
.gitignore vendored Normal file
View file

@ -0,0 +1,93 @@
bin
.vs
*.dat
*.suo
*.pch
*.ipch
*.g.cs
*.g.i.cs
*.log
*.tlog
*.db
*.vcdb
*.bin
*.exe
*.pdb
*.obj
*.pcb
*.ilk
/lib/boost_1_63_0
/Sapphire.VC.VC.opendb
*.user
*.dat
*.metagen
*.dll
*.ipdb
*.iobj
/Tools/bin
/Tools/FFXIVMon/FFXIVMon/Debug
/Tools/FFXIVMon/FFXIVMon/Release
/Tools/FFXIVMonChai/Debug
/Tools/GfxApiDemo/Debug
/Tools/packet_parser/packet_parser/Debug
/Tools/pcb_reader/Debug
/Tools/quest_parser/Debug
/Tools/quest_parser/generated
/Tools/quest_parser/Release
/Tools/SapphireBootWPF/bin/x86/Debug
/Tools/SapphireBootWPF/obj/Debug
/Tools/SapphireBootWPF/obj/x86/Debug
/Tools/SapphireBootWPF/obj/x86/Release
/Tools/SapphireBootWPF/obj/x86/Release
/Tools/SapphireBootWPF/obj/x86/Release
/Tools/SapphireBootWPF/obj/x86/Release/SapphireBootWPF_MarkupCompile.lref
/Tools/SapphireBootWPF/obj/x86/Release/SapphireBootWPF_MarkupCompile.i.lref
/Tools/SapphireBootWPF/obj/x86/Release/SapphireBootWPF_MarkupCompile.i.cache
/Tools/SapphireBootWPF/obj/x86/Release/SapphireBootWPF_MarkupCompile.cache
/Tools/SapphireBootWPF/obj/x86/Release/SapphireBootWPF.csproj.FileListAbsolute.txt
/Tools/SapphireBootWPF/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache
/Tools/SapphireBootWPF/obj/x86/Release/CoreCompileInputs.cache
/Tools/SapphireBootWPF/obj/x86/Release/CoreCompileInputs.cache
*.cache
/Tools/GfxApiDemo/collision2
/Server_Common/x64/Debug/vc140.idb
/Server_Common/lib/Sapphire_Commond.lib
/Server_Common/Debug/Server_Common.idb
/Research/packet_templates/Server/FFXIV_12.bt
/packages
/lib/xiv_dat_lib/test_case
/lib/xiv_dat_lib/Release/xiv_dat_lib.lib
/lib/xiv_dat_lib/xiv_dat_lib.lib
/intermediate2
/intermediate
/Debug
/bin/s
/bin/initui_1121.cpp
/lib/xiv_dat_lib/.vs
/Server_Common/.vs
/Server_Common/.vs
/src/lib/boost_1_63_0
/src/lib/boost_1_63_0
/.vs
/.vs/VSWorkspaceState.json
/.vs/slnx.sqlite
/.vs/ProjectSettings.json
/src/sapphire/.vs
/src/.vs
/bin/Debug
/src/.vs
*.lib
/src/sapphire/datReader/Debug/xivdat.lib
/src/sapphire/Server_Common/Debug/Common.lib
!EasyHook32.dll
!EasyHook32Svc.exe
!EasyHook64.dll
!EasyHook64Svc.exe
!EasyLoad32.dll
!EasyLoad64.dll
CMakeFiles/
*/CMakeFiles/
*.cmake
*.filters
/src/servers/.vs
/src/servers/.vs

View file

@ -12,7 +12,7 @@
<!-- Port the world server listens for clients -->
<ZonePort>54992</ZonePort>
<!-- Address to connect to the rest server -->
<RestHost>127.0.0.1:8080</RestHost>
<RestHost>127.0.0.1:80</RestHost>
<!-- Secret for server authentication -->
<ServerSecret>default</ServerSecret>
<!-- Connection settings for the mysql db -->

View file

@ -14,7 +14,7 @@
<!-- Secret used for server auth -->
<ServerSecret>default</ServerSecret>
<!-- Web server port -->
<HttpPort>8080</HttpPort>
<HttpPort>80</HttpPort>
<Mysql>
<Host>127.0.0.1</Host>
<Port>3306</Port>

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -632,7 +632,6 @@ namespace Core {
WaitFCApproval,
NotFound,
Offline,
CameraMode,
Mentor,
Busy,
PvP,
@ -640,6 +639,7 @@ namespace Core {
Cutscene,
ChocoPorter,
Afk,
CameraMode,
LfRepairs,
LfRepair,
LfMeld,

View file

@ -29,9 +29,17 @@ template
<typename T>
T clamp( T val, T minimum, T maximum )
{
// TODO: Lazy hack, do this properly...
return maximum;
// return std::max( std::min( val, maximum ), minimum );
if (val > maximum)
{
return maximum;
}
if (val < minimum)
{
return minimum;
}
return val;
}
}
}

View file

@ -521,6 +521,88 @@ int main()
};
server.resource["^(/frontier-api/ffxivsupport/view/get_init)(.*)"]["GET"] = [&server]( shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request ) {
print_request_info( request );
try
{
auto web_root_path = boost::filesystem::canonical( "web" );
auto path = boost::filesystem::canonical( web_root_path / "news.xml" );
//Check if path is within web_root_path
if( distance( web_root_path.begin(), web_root_path.end() ) > distance( path.begin(), path.end() ) ||
!equal( web_root_path.begin(), web_root_path.end(), path.begin() ) )
throw invalid_argument( "path must be within root path" );
if( !( boost::filesystem::exists( path ) && boost::filesystem::is_regular_file( path ) ) )
throw invalid_argument( "file does not exist" );
std::string cache_control, etag;
// Uncomment the following line to enable Cache-Control
// cache_control="Cache-Control: max-age=86400\r\n";
auto ifs = make_shared<ifstream>();
ifs->open( path.string(), ifstream::in | ios::binary | ios::ate );
if( *ifs )
{
auto length = ifs->tellg();
ifs->seekg( 0, ios::beg );
*response << "HTTP/1.1 200 OK\r\n" << cache_control << etag << "Content-Length: " << length << "\r\n\r\n";
default_resource_send( server, response, ifs );
}
else
throw invalid_argument( "could not read file" );
}
catch( exception& e )
{
*response << "HTTP/1.1 500\r\n\r\n";
g_log.error( e.what() );
}
};
server.resource["^(/frontier-api/ffxivsupport/information/get_headline_all)(.*)"]["GET"] = [&server]( shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request ) {
print_request_info( request );
try
{
auto web_root_path = boost::filesystem::canonical( "web" );
auto path = boost::filesystem::canonical( web_root_path / "headlines.xml" );
//Check if path is within web_root_path
if( distance( web_root_path.begin(), web_root_path.end() ) > distance( path.begin(), path.end() ) ||
!equal( web_root_path.begin(), web_root_path.end(), path.begin() ) )
throw invalid_argument( "path must be within root path" );
if( !( boost::filesystem::exists( path ) && boost::filesystem::is_regular_file( path ) ) )
throw invalid_argument( "file does not exist" );
std::string cache_control, etag;
// Uncomment the following line to enable Cache-Control
// cache_control="Cache-Control: max-age=86400\r\n";
auto ifs = make_shared<ifstream>();
ifs->open( path.string(), ifstream::in | ios::binary | ios::ate );
if( *ifs )
{
auto length = ifs->tellg();
ifs->seekg( 0, ios::beg );
*response << "HTTP/1.1 200 OK\r\n" << cache_control << etag << "Content-Length: " << length << "\r\n\r\n";
default_resource_send( server, response, ifs );
}
else
throw invalid_argument( "could not read file" );
}
catch( exception& e )
{
*response << "HTTP/1.1 500\r\n\r\n";
g_log.error( e.what() );
}
};
//Default GET-example. If no other matches, this anonymous function will be called.
//Will respond with content in the web/-directory, and its subdirectories.
//Default file: index.html