summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostyantyn Ovechko <fastinetserver@gmail.com>2010-08-12 13:40:14 +0300
committerKostyantyn Ovechko <fastinetserver@gmail.com>2010-08-12 13:40:14 +0300
commit17d325854b2c6a74db76418b0d8aa749383e8e39 (patch)
tree1e6438e01bc471e5d1bdb222d009ccb79c531509
parentFix tuiclient scrollwindow when there're no lines. (diff)
downloadidfetch-17d325854b2c6a74db76418b0d8aa749383e8e39.tar.gz
idfetch-17d325854b2c6a74db76418b0d8aa749383e8e39.tar.bz2
idfetch-17d325854b2c6a74db76418b0d8aa749383e8e39.zip
Adjust default folders.
By default segget daemon will use the following folders for its files: /etc/seggetd - for config files for seggetd, tuiclient and request tool /usr/bin - binary files: seggetd, tuiclient, request /usr/share/seggetd/scripts - for user-side python script files /usr/share/seggetd/webui - for webui files /tmp/seggetd/pkg.list - to save distfile list generated by portage and parse it by request tool to segget daemon /tmp/seggetd/segments - to store segments /usr/portage/distfiles - to store ready to use distfiles /var/log/seggetd - to store log files
-rw-r--r--request/config.cpp4
-rw-r--r--request/request.h1
-rw-r--r--request/settings.cpp2
-rw-r--r--request/settings.h64
-rw-r--r--segget/segget.conf17
-rw-r--r--segget/settings.cpp1
-rw-r--r--segget/settings.h2
-rw-r--r--segget/ui_server.cpp4
-rw-r--r--segget/webui/img/mirrors.jpgbin0 -> 7609 bytes
-rw-r--r--segget/webui/img/rss.jpgbin0 -> 4591 bytes
-rw-r--r--segget/webui/img/stats.jpgbin0 -> 4360 bytes
11 files changed, 26 insertions, 69 deletions
diff --git a/request/config.cpp b/request/config.cpp
index 0cc5395..3e0a2eb 100644
--- a/request/config.cpp
+++ b/request/config.cpp
@@ -31,10 +31,10 @@ void Tconfig::load_settings_from_config_file(){
ifstream file;
file.exceptions (ifstream::failbit | ifstream::badbit);
try{
- file.open((settings.conf_dir+"/"+config_file_name).c_str());
+ file.open(config_file_name.c_str());
}
catch(...){
- merror("Error opening settings file: "+settings.conf_dir+"/"+config_file_name+". Default settings will be used. Check if config file: "+config_file_name+" exists and segget has rights to access it.");
+ merror("Error opening settings file: "+config_file_name+". Default settings will be used. Check if config file: "+config_file_name+" exists and segget has rights to access it.");
return;
}
try{
diff --git a/request/request.h b/request/request.h
index b627394..1be6ff3 100644
--- a/request/request.h
+++ b/request/request.h
@@ -31,7 +31,6 @@
#include <string.h>
#include <signal.h>
#include <stdlib.h>
-#include <stdio.h>
#include <fstream>
#include <iostream>
#include <json/json.h>
diff --git a/request/settings.cpp b/request/settings.cpp
index bf386ea..8bfdf37 100644
--- a/request/settings.cpp
+++ b/request/settings.cpp
@@ -30,7 +30,7 @@ Tsettings settings;
void Tsettings::init(){
try{
- Tconfig conf("segget.conf");
+ Tconfig conf(conf_dir+"/segget.conf");
// conf.set("logs","general_log_file",general_log_file);
// conf.set("logs","logs_dir",logs_dir);
// conf.set("logs","error_log_file",error_log_file);
diff --git a/request/settings.h b/request/settings.h
index 0a6b48a..1ded0a7 100644
--- a/request/settings.h
+++ b/request/settings.h
@@ -38,38 +38,8 @@ class Tsettings{
public:
string conf_dir;
bool no_daemon_flag;
- //folders
-// string distfiles_dir;
-// string segments_dir;
//pkg_list
-// string pkg_list_dir;
string pkg_list_file;
-// bool del_pkg_list_when_dld_finished;
- //distfiles
-// ulong max_connection_num_per_distfile;
- //segments
-// ulong max_segment_size;
-// bool resume_on;
-// ulong max_tries;
- //connections
-// ulong max_connections;
-// ulong connection_timeout;
-// ulong ftp_response_timeout;
-// ulong time_out;
-// ulong low_connection_speed_limit;
-// ulong low_connection_speed_time;
-// ulong max_connection_speed;
-// ulong current_speed_time_interval_msecs;
-// string bind_interface;
- //mirrors
-// ulong max_connections_num_per_mirror;
-// ulong benchmark_oblivion;
- //provide_mirror_to_others
-// string provide_mirror_dir;
-// bool provide_mirror_files_restrict_list_on;
- //provide_proxy_fether_to_others
-// string provide_proxy_fetcher_ip;
-// ulong provide_proxy_fetcher_port;
//request_server
string request_ip;
ulong request_port;
@@ -82,38 +52,8 @@ class Tsettings{
Tsettings():
conf_dir("/etc/seggetd"),
no_daemon_flag(false),
- //folders
-// distfiles_dir("./distfiles"),
-// segments_dir("./tmp"),
//pkg_list
-// pkg_list_dir("./"),
- pkg_list_file("./pkg.list"),
-// del_pkg_list_when_dld_finished(1),
- //distfiles
-// max_connection_num_per_distfile(3),
- //segments
-// max_segment_size(500000),
-// resume_on(1),
-// max_tries(10),
- //connections
-// max_connections(6),
-// connection_timeout(15),
-// ftp_response_timeout(180),
-// time_out(500),
-// low_connection_speed_limit(1000),
-// low_connection_speed_time(10),
-// max_connection_speed(0),
-// current_speed_time_interval_msecs(1000),
-// bind_interface("none"),
- //mirrors
-// max_connections_num_per_mirror(1),
-// benchmark_oblivion(5),
- //provide_mirror_to_others
-// provide_mirror_dir("none"),
-// provide_mirror_files_restrict_list_on(0),
- //provide_proxy_fether_to_others
-// provide_proxy_fetcher_ip("127.0.0.1"),
-// provide_proxy_fetcher_port(9888),
+ pkg_list_file("/tmp/seggetd/pkg.list"),
//request_server
request_ip("127.0.0.1"),
request_port(10000)
@@ -123,8 +63,6 @@ class Tsettings{
// error_log_file("error.log"),
// debug_log_file("debug.log")
{};
-// void set_resume(bool resume_setting){resume_on=resume_setting;};
-// bool get_resume(){return resume_on;};
void init();
};
diff --git a/segget/segget.conf b/segget/segget.conf
index f2de2f5..4d6413d 100644
--- a/segget/segget.conf
+++ b/segget/segget.conf
@@ -1,4 +1,15 @@
[folders]
+# By default segget daemon will use the following folders for its files:
+# /etc/seggetd - for config files for seggetd, tuiclient and request tool
+# /usr/bin - binary files: seggetd, tuiclient, request
+# /usr/share/seggetd/scripts - for user-side python script files
+# /usr/share/seggetd/webui - for webui files
+# /tmp/seggetd/pkg.list - to save distfile list generated by portage and parse it
+# by request tool to segget daemon
+# /tmp/seggetd/segments - to store segments
+# /usr/portage/distfiles - to store ready to use distfiles
+# /var/log/seggetd - to store log files
+
# DISTFILES_DIR
# Define a dir to store distfiles
# Default:
@@ -269,6 +280,12 @@ ui_ip=127.0.0.1
# ui_port=9999
ui_port=9999
+# UI_WEB_UI_DIR
+# Define a dir where segget stores webui files
+# Default:
+# ui_web_ui_dir=/usr/share/seggetd/webui
+ui_web_ui_dir=/usr/share/seggetd/webui
+
[rss]
# RSS feed provides information on the files added (symlinked)
# to PROVIDE_MIRROR_DIR and can be accessed from feedreader
diff --git a/segget/settings.cpp b/segget/settings.cpp
index 69c3d1d..c3a0c8f 100644
--- a/segget/settings.cpp
+++ b/segget/settings.cpp
@@ -126,6 +126,7 @@ void Tsettings::init(){
}
conf.set("ui_server","ui_ip",ui_ip);
conf.set("ui_server","ui_port",ui_port,1,65535);
+ conf.set("ui_server","ui_web_ui_dir",ui_web_ui_dir);
conf.set("provide_mirror_to_others","provide_mirror_to_others_url",provide_mirror_to_others_url);
if (provide_mirror_to_others_url=="ui_ip"){
diff --git a/segget/settings.h b/segget/settings.h
index 5523f90..3633aa4 100644
--- a/segget/settings.h
+++ b/segget/settings.h
@@ -78,6 +78,7 @@ class Tsettings{
//ui_server
string ui_ip;
ulong ui_port;
+ string ui_web_ui_dir;
//rss
string provide_mirror_to_others_url;
string rss_title;
@@ -137,6 +138,7 @@ class Tsettings{
//ui_server
ui_ip("127.0.0.1"),
ui_port(9999),
+ ui_web_ui_dir("/usr/share/seggetd/webui"),
//rss
provide_mirror_to_others_url("http://"+ui_ip), // init after ui_ip
rss_title("Seggetd feed"),
diff --git a/segget/ui_server.cpp b/segget/ui_server.cpp
index eaa0f57..c92f079 100644
--- a/segget/ui_server.cpp
+++ b/segget/ui_server.cpp
@@ -653,9 +653,9 @@ void Tui_server::serve_browser(uint fd, string msg){
}else if (uri=="/distfiles_"){
ui_server.send_to_fd(fd,get_html_distfiles());
}else if (uri=="/favicon.ico"){
- ui_server.send_binary_to_fd(fd,"./webui/img/favicon.ico");
+ ui_server.send_binary_to_fd(fd,settings.ui_web_ui_dir+"/favicon.ico");
}else if (uri.find("/img")!=uri.npos){
- ui_server.send_binary_to_fd(fd,"./webui"+uri);
+ ui_server.send_binary_to_fd(fd,settings.ui_web_ui_dir+uri);
}else{
send_to_fd(fd,get_html_header("Connections"));
send_to_fd(fd,"<span id=\"connections\">\n");
diff --git a/segget/webui/img/mirrors.jpg b/segget/webui/img/mirrors.jpg
new file mode 100644
index 0000000..e1457d1
--- /dev/null
+++ b/segget/webui/img/mirrors.jpg
Binary files differ
diff --git a/segget/webui/img/rss.jpg b/segget/webui/img/rss.jpg
new file mode 100644
index 0000000..9365ab8
--- /dev/null
+++ b/segget/webui/img/rss.jpg
Binary files differ
diff --git a/segget/webui/img/stats.jpg b/segget/webui/img/stats.jpg
new file mode 100644
index 0000000..049f1dd
--- /dev/null
+++ b/segget/webui/img/stats.jpg
Binary files differ