Merge branch 'master' of git.c3d2.de:sic++

Conflicts:
	src/sicmain.cc
This commit is contained in:
john stone 2014-05-02 00:56:29 +02:00
commit 921ac4f8ef
5 changed files with 11 additions and 11 deletions

View File

@ -10,7 +10,7 @@ std::string DynamicObjects::render_object_list(){
for (auto& it : this->m_thevec){ for (auto& it : this->m_thevec){
output += u8"<li>\n"; output += u8"<li>\n";
output += u8"<a href=\"" + m_merouterin->get_baseurl() + it.get_path() + u8"\">"; //we could include baseurl here? output += u8"<a href=\"" + m_merouterin->get_baseurl() + it.get_filepath() + u8"\">"; //we could include baseurl here?
output += it.get_filename(); output += it.get_filename();
output += u8"</a> <span class=\"size\">"; output += u8"</a> <span class=\"size\">";
output += it.get_pretty_sized(); output += it.get_pretty_sized();

View File

@ -84,7 +84,7 @@ class SicccPersister
json_t *root = json_object(); json_t *root = json_object();
json_object_set_new(root, "filename", get_json_from_string(so.get_filename())); json_object_set_new(root, "filename", get_json_from_string(so.get_filename()));
json_object_set_new(root, "filetype", get_json_from_string(so.get_filetype())); json_object_set_new(root, "filetype", get_json_from_string(so.get_filetype()));
json_object_set_new(root, "path", get_json_from_string(so.get_path())); json_object_set_new(root, "path", get_json_from_string(so.get_filepath()));
json_object_set_new(root, "size", get_json_from_integer(so.get_size())); json_object_set_new(root, "size", get_json_from_integer(so.get_size()));
std::string tmp = time_to_string(so.get_uploadtime()); std::string tmp = time_to_string(so.get_uploadtime());
json_object_set_new(root, "upload_time", get_json_from_string(tmp)); json_object_set_new(root, "upload_time", get_json_from_string(tmp));
@ -110,7 +110,7 @@ class SicccPersister
struct dirent *entry = nullptr; struct dirent *entry = nullptr;
std::vector<Sicccobject> v; std::vector<Sicccobject> v;
json_error_t *error = nullptr; json_error_t *error = nullptr;
if ((dir = opendir(merouter.get_persist_path().c_str())) == NULL) { if ((dir = opendir(merouter.get_json_path().c_str())) == NULL) {
std::cerr << "Error could not open directory" << std::endl; std::cerr << "Error could not open directory" << std::endl;
return v; // should throw exception instea1d return v; // should throw exception instea1d
} }
@ -155,7 +155,6 @@ class SicccPersister
int write_sicccfile(const Sicccobject&); int write_sicccfile(const Sicccobject&);
int write_sicccfile(); int write_sicccfile();
/* std::vector<Sicccobject> read_sicccdir(); */
Sicccobject read_json(const std::string&); Sicccobject read_json(const std::string&);
Sicccobject read_json() { return read_json(json_file_name); } Sicccobject read_json() { return read_json(json_file_name); }

View File

@ -17,7 +17,7 @@ int
SicccPersister::write_sicccfile() SicccPersister::write_sicccfile()
{ {
assert(!json_file_name.empty()); assert(!json_file_name.empty());
std::string store_str = merouter.get_persist_path() + "/" + beautify_filename(); std::string store_str = merouter.get_json_path() + "/" + beautify_filename();
assert(root); assert(root);
int ret = json_dump_file(root, store_str.c_str(), JSON_INDENT(4)); int ret = json_dump_file(root, store_str.c_str(), JSON_INDENT(4));
return ret; return ret;

View File

@ -18,7 +18,7 @@ class Sicccobject {
const size_t sz) const size_t sz)
: filename(file), : filename(file),
filetype(ftype), filetype(ftype),
path(fpath), filepath(fpath),
size(sz) size(sz)
{ {
upload_date = std::chrono::system_clock::now(); upload_date = std::chrono::system_clock::now();
@ -30,7 +30,7 @@ class Sicccobject {
const size_t sz) const size_t sz)
: filename(file), : filename(file),
filetype(ftype), filetype(ftype),
path(fpath), filepath(fpath),
size(sz) size(sz)
{ {
upload_date = std::chrono::system_clock::now(); upload_date = std::chrono::system_clock::now();
@ -43,7 +43,7 @@ class Sicccobject {
const std::chrono::time_point<std::chrono::system_clock>& date) const std::chrono::time_point<std::chrono::system_clock>& date)
: filename(file), : filename(file),
filetype(ftype), filetype(ftype),
path(fpath), filepath(fpath),
size(sz), size(sz),
upload_date(date) { } upload_date(date) { }
@ -54,7 +54,7 @@ class Sicccobject {
std::string get_filename() const { return filename; } std::string get_filename() const { return filename; }
std::string get_filetype() const { return filetype; } std::string get_filetype() const { return filetype; }
std::string get_path() const { return path; } std::string get_filepath() const { return filepath; }
size_t get_size() const { return size; } size_t get_size() const { return size; }
std::chrono::time_point<std::chrono::system_clock> std::chrono::time_point<std::chrono::system_clock>
get_uploadtime() const { return upload_date; } get_uploadtime() const { return upload_date; }
@ -77,7 +77,7 @@ class Sicccobject {
private: private:
std::string filename; std::string filename;
std::string filetype; std::string filetype;
std::string path; std::string filepath;
size_t size; size_t size;
std::chrono::time_point<std::chrono::system_clock> upload_date; std::chrono::time_point<std::chrono::system_clock> upload_date;
}; };

View File

@ -29,7 +29,8 @@ class MongooseHandler{
listenport(listenport) listenport(listenport)
{ {
char portstring[8]; char portstring[8];
std::snprintf(portstring,8,"%d",this->listenport); std::snprintf(portstring,8,"%d",this->listenport);
const char *options[] = const char *options[] =
{"listening_ports",portstring,nullptr}; {"listening_ports",portstring,nullptr};