| 40 | } |
| 41 | |
| 42 | void FSecure::Dropbox::WriteMessageToFile(std::string const& direction, ByteView data, std::string const& providedFilename) |
| 43 | { |
| 44 | std::string url = OBF_STR("https://content.dropboxapi.com/2/files/upload"); |
| 45 | |
| 46 | std::string filename; |
| 47 | |
| 48 | if (providedFilename.empty()) |
| 49 | { |
| 50 | ///Create a filename thats prefixed with message direction and suffixed |
| 51 | // with more granular timestamp for querying later |
| 52 | std::string ts = std::to_string(FSecure::Utils::TimeSinceEpoch()); |
| 53 | filename = direction + OBF("-") + FSecure::Utils::GenerateRandomString(10) + OBF("-") + ts; |
| 54 | } |
| 55 | else |
| 56 | filename = providedFilename; |
| 57 | |
| 58 | json j; |
| 59 | j[OBF("path")] = OBF("/") + this->m_Channel + OBF("/") + filename; |
| 60 | j[OBF("mode")] = OBF("add"); |
| 61 | j[OBF("autorename")] = false; |
| 62 | j[OBF("mute")] = true; |
| 63 | j[OBF("strict_conflict")] = true; |
| 64 | |
| 65 | SendHttpRequest(url, j.dump(), ContentType::ApplicationOctetstream, data); |
| 66 | } |
| 67 | |
| 68 | void FSecure::Dropbox::UploadFile(std::string const& path) |
| 69 | { |
no test coverage detected