Skip to content

Commit

Permalink
Merge branch 'develop' for release v5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
epoupon committed Jan 6, 2022
2 parents a1a6914 + 7f1d7bb commit 76300bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/fileshelter/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ int main(int argc, char *argv[])
shareManager->removeOrphanFiles(uploadedFilesPath);

ShareResource shareResource;
if (!deployPath.empty() && deployPath.back() == '/')
shareResource.setDeployPath(deployPath + "share");
else
shareResource.setDeployPath(deployPath + "/share");
server.addResource(&shareResource, std::string {shareResource.getDeployPath()});
server.addEntryPoint(Wt::EntryPointType::Application, [&](const Wt::WEnvironment& env)
{
Expand Down
7 changes: 5 additions & 2 deletions src/fileshelter/resources/ShareResource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ class ShareResource : public Wt::WResource
public:
~ShareResource();

static constexpr std::string_view getDeployPath() { return "/share"; }
static Wt::WLink createLink(const Share::ShareUUID& shareId, std::optional<std::string_view> password);
static void setDeployPath(std::string_view deployPath) { _deployPath = deployPath; }
static std::string_view getDeployPath() { return _deployPath; }
static Wt::WLink createLink(const Share::ShareUUID& shareId, std::optional<std::string_view> password);

private:
static inline std::string _deployPath;
void handleRequest(const Wt::Http::Request& request, Wt::Http::Response& response) override;
};

Expand Down

0 comments on commit 76300bf

Please sign in to comment.