Skip to content

Commit

Permalink
fix httpserver mappath bug
Browse files Browse the repository at this point in the history
  • Loading branch information
fawdlstty committed Apr 15, 2021
1 parent 460072e commit 7241955
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion DuiLib_Faw
4 changes: 2 additions & 2 deletions NetToolbox.sln
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ Global
{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.LTL|x64.Build.0 = LTL|x64
{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.LTL|x86.ActiveCfg = LTL|Win32
{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.LTL|x86.Build.0 = LTL|Win32
{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|Any CPU.ActiveCfg = SRelease|Win32
{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|Any CPU.Build.0 = SRelease|Win32
{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|Any CPU.ActiveCfg = SReleaseA|Win32
{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|Any CPU.Build.0 = SReleaseA|Win32
{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|x64.ActiveCfg = Release|x64
{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|x64.Build.0 = Release|x64
{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|x86.ActiveCfg = Release|Win32
Expand Down
5 changes: 1 addition & 4 deletions NetToolbox/NetToolbox.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,7 @@
7z u -tzip "$(SolutionDir)$(ProjectName)\res\res.zip" "$(SolutionDir)res\*"</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>upx -9 $(SolutionDir)$(IntDir)$(TargetFileName)
$(SolutionDir)NetToolbox_publish32.exe
del $(SolutionDir)$(IntDir)NetToolbox.7z /q
7z u -t7z $(SolutionDir)$(IntDir)NetToolbox.7z $(SolutionDir)$(IntDir)license.txt* $(SolutionDir)$(IntDir)*.exe</Command>
<Command>upx -9 $(SolutionDir)$(IntDir)$(TargetFileName)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='LTL|Win32'">
Expand Down
Binary file modified NetToolbox/Resource.aps
Binary file not shown.
Binary file modified NetToolbox/Resource.rc
Binary file not shown.
17 changes: 8 additions & 9 deletions NetToolbox/pages/page_HttpServer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class _session_storage: public xfinal::session_storage {
class page_HttpServer: public page_base {
public:
page_HttpServer (NetToolboxWnd *parent): page_base (parent) {
_add_item (_T (""), _T (""), true);
_add_item (false);
_add_item (true);
}

bool OnClick (TNotifyUI &msg) override {
Expand Down Expand Up @@ -136,8 +137,8 @@ class page_HttpServer: public page_base {
} else if (name == _T ("httpserver_maplist_ctrl_new")) {
CControlUI *container = msg.pSender->GetParent ()->GetParent ();
m_httpserver_maplist->Remove (container);
_add_item (_T (""), _T (""), false);
_add_item (_T (""), _T (""), true);
_add_item (false);
_add_item (true);
return true;
} else if (name == _T ("httpserver_maplist_ctrl_del")) {
CControlUI *container = msg.pSender->GetParent ()->GetParent ();
Expand Down Expand Up @@ -191,19 +192,19 @@ class page_HttpServer: public page_base {
for (size_t i = 0; i < m_maplist.size (); ++i) {
auto &[_disk_path, _url_path] = m_maplist [i];
if (_url.compare (0, _url_path.size (), _url_path) == 0) {
std::string _file_path = _disk_path + _url.substr (_url_path.size ());
std::string _file_path = fmt::format (_T ("{}{}{}"), _disk_path, *_disk_path.crbegin () == '\\' ? "" : "\\", _url.substr (_url_path.size ()));
tool_StringA::replace (_file_path, '/', '\\');
tool_StringA::replace (_file_path, "\\\\", "\\");
if (faw::File::exist (_file_path)) {
res.write_file (_file_path, true);
res.write_file_view (_file_path, true);
return;
}
if (_file_path [_file_path.size () - 1] != '\\')
_file_path.push_back ('\\');
for (size_t j = 0; j < m_indexes.size (); ++j) {
std::string _file_path1 = _file_path + m_indexes [j];
if (faw::File::exist (_file_path1)) {
res.write_file (_file_path1, true);
res.write_file_view (_file_path1, true);
return;
}
}
Expand All @@ -215,7 +216,7 @@ class page_HttpServer: public page_base {

protected:
// add new line
void _add_item (faw::string_t key, faw::string_t value, bool _is_new) {
void _add_item (bool _is_new) {
static size_t n_sign = 0;
CListContainerElementUI *item = new CListContainerElementUI ();
item->SetFixedHeight (20);
Expand All @@ -230,7 +231,6 @@ class page_HttpServer: public page_base {
ctnr = new CContainerUI ();
ctrl = new CEditUI ();
ctrl->SetManager (m_parent->get_pm (), item);
ctrl->SetText (key);
ctrl->SetAttribute (_T ("name"), fmt::format (_T ("httpserver_maplist_item_{}_key"), n_sign));
ctrl->SetAttribute (_T ("bkcolor"), color);
ctrl->SetAttribute (_T ("nativebkcolor"), color);
Expand All @@ -247,7 +247,6 @@ class page_HttpServer: public page_base {
ctnr = new CContainerUI ();
ctrl = new CEditUI ();
ctrl->SetManager (m_parent->get_pm (), item);
ctrl->SetText (value);
ctrl->SetAttribute (_T ("name"), fmt::format (_T ("httpserver_maplist_item_{}_value"), n_sign));
ctrl->SetAttribute (_T ("bkcolor"), color);
ctrl->SetAttribute (_T ("nativebkcolor"), color);
Expand Down
Binary file modified NetToolbox/res/qqwry.dat
Binary file not shown.
Binary file modified NetToolbox/res/res.zip
Binary file not shown.
Binary file removed NetToolbox_publish.exe
Binary file not shown.
Binary file removed NetToolbox_publish32.exe
Binary file not shown.

0 comments on commit 7241955

Please sign in to comment.