* add documentation
authorWilfried Göesgens <willi@citadel.org>
Mon, 20 Mar 2006 14:54:45 +0000 (14:54 +0000)
committerWilfried Göesgens <willi@citadel.org>
Mon, 20 Mar 2006 14:54:45 +0000 (14:54 +0000)
* made directories configurable from start.
* make debian package build work again.

webcit/Makefile.am
webcit/README
webcit/configure.in
webcit/debian/rules
webcit/src/webcit.c
webcit/src/webserver.c
webcit/src/webserver.h

index 12d055012bf3bffc7fd9cd20128003d945df36c6..8f3d13ad5c245c42251fb9da5a3003bcbbe309d5 100644 (file)
@@ -10,7 +10,8 @@ DISTFILES=ABOUT_NLS
 # usual unix way would be here: $(datadir)/$(PACKAGE)
 #STATIC_DIR=@STATIC_DIR@
 
 # usual unix way would be here: $(datadir)/$(PACKAGE)
 #STATIC_DIR=@STATIC_DIR@
 
-DIRS=tiny_mce static
+DIRS= static
+EDITOR_DIRS=tiny_mce
 
 
 
 
 
 
@@ -29,3 +30,16 @@ install-data-local:
                                        done \
                        done \
                done
                                        done \
                        done \
                done
+
+               export STATIC_DIR=@editor@; \
+               for dir in $(EDITOR_DIRS); do \
+                       $(mkinstalldirs) $(DESTDIR)/$$STATIC_DIR/$$dir; \
+                       for subdir in `find $$dir -type d |grep -v .svn`; do \
+                               $(mkinstalldirs) $(DESTDIR)/$$STATIC_DIR/$$subdir; \
+                                       for file in $(srcdir)/$$subdir/*; do \
+                                               if test -f "$$file" ; then \
+                                                       $(INSTALL_DATA) $$file $(DESTDIR)$$STATIC_DIR/$$subdir; \
+                                               fi \
+                                       done \
+                       done \
+               done
index a530f5e29fb45b61b06bf76b31332ca9c4195733..11f3b635010bdd9fc9a8d727700862e1f1a4c1c6 100644 (file)
@@ -61,6 +61,9 @@ port.  The default is port 2000.
   make
   make install
  
   make
   make install
  
+ Package/Ports Maintainers: to make webcit fit smart into LHFS-ified systems
+ read on at the end of this file, Advanced configure options.
+
  Then to initialize it:
   cd /usr/local/webcit
   ./setup
  Then to initialize it:
   cd /usr/local/webcit
   ./setup
@@ -198,7 +201,64 @@ generate a key and certificate.
  It is up to you to decide whether to use an automatically generated,
 self-signed certificate, or purchase a certificate signed by a well known
 authority.
  It is up to you to decide whether to use an automatically generated,
 self-signed certificate, or purchase a certificate signed by a well known
 authority.
-  
+
+
+ INTEGRATING INTO APACHE
+ -----------------------
+
+ If you want to include webcit into an Apache, because of you want to have it
+running alongside your i.e. php applications without adding another ip or using a 
+different port than 443 / 80 (which may be blocked by company firewalls for 
+example) you can do this with apaches mod_proxy. One can do this either to make
+webcit fill up into a full vhost (like webcit.mydomain.com) or to go into a 
+subdirectory (like www.mydomain.com/webcit). find two config snippets, that can
+be added to apaches sample ssl config (which you may find in 
+/usr/share/doc/apache2/examples/ssl.conf for example) Warning: you should be somewhat
+experienced with configuring apache to do that!
+
+VHOST context:
+<VirtualHost mydomain.com:443>
+       #here some of your config stuff like logging, serveradmin...
+       NameVirtualHost www.mydomain.com
+    <location />
+         allow from all
+    </location>
+
+    ProxyPass / http://127.0.0.1:2000/
+    ProxyPassReverse / http://127.0.0.1:2000/
+# make apache give away static content like images...
+    alias /static /var/lib/citadel/www/static
+
+</VirtualHost>
+
+SUBDIR context:
+<VirtualHost mydomain.com:443>
+       #here some of your config stuff like logging, serveradmin...
+       NameVirtualHost www.mydomain.com
+    <location /webcit>
+      allow from all
+    </location>
+    <location /listsub>
+      allow from all
+    </location>
+    <location /groupdav>
+      allow from all
+    </location>
+    <location /who_inner_html>
+      allow from all
+    </location>
+
+    ProxyPass /webcit/ http://127.0.0.1:2000/webcit/
+    ProxyPassReverse /webcit/ http://127.0.0.1:2000/webcit/
+    ProxyPass /listsub/ http://127.0.0.1:2000/listsub/
+    ProxyPassReverse /listsub/ http://127.0.0.1:2000/listsub/
+    ProxyPass /groupdav/ http://127.0.0.1:2000/groupdav/
+    ProxyPassReverse /groupdav/ http://127.0.0.1:2000/groupdav/
+    ProxyPass /who_inner_html http://127.0.0.1:2000/who_inner_html
+    ProxyPassReverse /who_inner_html http://127.0.0.1:2000/who_inner_html
+# make apache give away static content like images...
+    alias /static /var/lib/citadel/www/static
+</VirtualHost>
  
  CONCLUSION
  ----------
  
  CONCLUSION
  ----------
@@ -206,3 +266,22 @@ authority.
  That's all you need to know to get started.  If you have any questions or
 comments, please visit UNCENSORED! BBS, the home of Citadel, at
 uncensored.citadel.org.
  That's all you need to know to get started.  If you have any questions or
 comments, please visit UNCENSORED! BBS, the home of Citadel, at
 uncensored.citadel.org.
+
+
+ ADVANCED CONFIGURE OPTIONS
+ --------------------------
+ To make webcit integrate smothly into your system there are several options available.
+--with-staticdir defines where webcit should put'n search its templates and images. If you
+want to go with a different Installation location then the point it is accessed at runtime, 
+you can use --with-staticrundir. This option is meant to ease your needs if you're going
+to install the static files as 'examples' in a location like /usr/share/doc/webcit/examples, 
+and enable the user to copy them over to another dir (like /var/lib/citadel/www), where 
+they're accessed at runtime. (The debian instatll scripts provided with this package 
+do this to preserve user changes to the template system, see debian/citadel-webcit.postinstall)
+
+[todo]
+Further there are possibilities to load the tiny_mce editor into a system uniq location. Webcit 
+uses this standard component compose its messages for mails and postings. Several webcit installations
+that may differ in design but use the same tiny_mce (which is the default that webcit ships with)
+
index a1385c236ba2f14006ab375081a856f9ad2f51d9..b937a0c913b1a7e1f6458bc880ac723a171375e8 100644 (file)
@@ -391,12 +391,31 @@ IT_PROG_INTLTOOL
 AC_SUBST(CFLAGS)
 AC_SUBST(SETUP_LIBS)
 
 AC_SUBST(CFLAGS)
 AC_SUBST(SETUP_LIBS)
 
+AC_ARG_WITH(rundir, [  --with-rundir=DIR          where to find the citadel servers sockets (overridable by -h  at runtime.)],
+                                          [ rundir=$withval ],[ rundir=/usr/local/citadel ] )
+AC_DEFINE_UNQUOTED([RUNDIR],["$rundir"],where should we make look for citadel sockets??)
 
 
 
 
-AC_ARG_WITH(staticdir, [  --with-staticdir=DIR          where to put datafiles],[ staticdir=$withval ],[ staticdir=$prefix/ ] )
+AC_ARG_WITH(staticdir, [  --with-staticdir=DIR          where to put datafiles],
+                                          [ staticdir=$withval ],[ staticdir=$prefix ] )
 AC_SUBST(staticdir)
 AC_SUBST(staticdir)
+
+AC_ARG_WITH(staticrundir, [  --with-staticrundir=DIR          where to search datafiles at runtime],
+                                                 [ staticrundir=$withval ],[ staticrundir=$staticdir ] )
+
+AC_DEFINE_UNQUOTED([DATADIR],["$staticrundir"],where should we make our root?)
+
+
+AC_ARG_WITH(editor, [  --with-editor=DIR          where to search the editor at runtime],
+                                                 [ editordir=$withval ],[ editordir=$staticrundir ] )
+AC_DEFINE_UNQUOTED([EDITORDIR],["$editordir"],where find the editor (tiny_mce)?)
+
+AC_SUBST(editor)
+
+
 AC_OUTPUT(Makefile src/Makefile po/Makefile.in   )
 
 AC_OUTPUT(Makefile src/Makefile po/Makefile.in   )
 
+
 echo ------------------------------------------------------------------------
 echo 'zlib compression:                ' $ok_zlib
 echo 'Calendar support:                ' $ok_libical
 echo ------------------------------------------------------------------------
 echo 'zlib compression:                ' $ok_zlib
 echo 'Calendar support:                ' $ok_libical
index 7fd18646e82464c573fdeefd6dd3c687f947a768..2975a9d83df729d9bea779f35414a219973638e0 100755 (executable)
@@ -28,10 +28,9 @@ configure-stamp:
                --host=$(DEB_HOST_GNU_TYPE) \
                --build=$(DEB_BUILD_GNU_TYPE) \
                --prefix=/usr \
                --host=$(DEB_HOST_GNU_TYPE) \
                --build=$(DEB_BUILD_GNU_TYPE) \
                --prefix=/usr \
-               --with-webcit-dir=/usr \
-               --with-sysconfdir=/etc/citadel \
-               --with-spooldir=/var/spool/citadel \
                --with-staticdir=/usr/share/doc/citadel-webcit/examples \
                --with-staticdir=/usr/share/doc/citadel-webcit/examples \
+               --with-staticrundir=/var/lib/citadel/www/ \
+               --with-editor=/usr/share/tiny_mce/ \
                --with-rundir=/var/run/citadel \
                --with-ical --with-db --with-ldap --with-zlib --with-ssl --with-libiconf --with-newt --with-included-gettext
 
                --with-rundir=/var/run/citadel \
                --with-ical --with-db --with-ldap --with-zlib --with-ssl --with-libiconf --with-newt --with-included-gettext
 
@@ -88,23 +87,15 @@ binary-arch: build install
        dh_installdocs
        dh_installexamples
 #      dh_install
        dh_installdocs
        dh_installexamples
 #      dh_install
-#      dh_installmenu
        dh_installdebconf       
 #      dh_installlogrotate
        dh_installdebconf       
 #      dh_installlogrotate
-#      dh_installemacsen
-#      dh_installpam
-#      dh_installmime
 #      dh_installinit
 #      dh_installcron
 #      dh_installinit
 #      dh_installcron
-#      dh_installinfo
        dh_installman
        dh_link
        dh_strip
        dh_compress
        dh_fixperms
        dh_installman
        dh_link
        dh_strip
        dh_compress
        dh_fixperms
-#      dh_perl
-#      dh_python
-#      dh_makeshlibs
        dh_installdeb
        dh_shlibdeps
        dh_gencontrol
        dh_installdeb
        dh_shlibdeps
        dh_gencontrol
index 85ee1ca4ba9e28af897fcee0279dcaf1dc18074d..dd3503d4cce4caa45c736a6557808b51aa4d2280 100644 (file)
 #include "webserver.h"
 #include "mime_parser.h"
 
 #include "webserver.h"
 #include "mime_parser.h"
 
-/**
- * Subdirectories from which the client may request static content
- */
-char *static_content_dirs[] = {
-       "static",                     /** static templates */
-       "tiny_mce"                    /** the JS editor */
-};
-
 /**
  * String to unset the cookie.
  * Any date "in the past" will work, so I chose my birthday, right down to
 /**
  * String to unset the cookie.
  * Any date "in the past" will work, so I chose my birthday, right down to
@@ -1195,8 +1187,8 @@ void session_loop(struct httprequest *req)
 
        /** Static content can be sent without connecting to Citadel. */
        is_static = 0;
 
        /** Static content can be sent without connecting to Citadel. */
        is_static = 0;
-       for (a=0; a<(sizeof(static_content_dirs) / sizeof(char *)); ++a) {
-               if (!strcasecmp(action, static_content_dirs[a])) {
+       for (a=0; a<ndirs; ++a) {
+               if (!strcasecmp(action, (char*)static_content_dirs[a])) { /* map web to disk location */
                        is_static = 1;
                }
        }
                        is_static = 1;
                }
        }
index 08848d1ea0257fb9f2c48b8fe408d1ea3c0ccbe4..d9cedce5ee2106383387d793aa0002970552d18f 100644 (file)
@@ -24,11 +24,30 @@ int verbosity = 9;          /**< Logging level */
 int msock;                         /**< master listening socket */
 int is_https = 0;              /**< Nonzero if I am an HTTPS service */
 int follow_xff = 0;            /**< Follow X-Forwarded-For: header */
 int msock;                         /**< master listening socket */
 int is_https = 0;              /**< Nonzero if I am an HTTPS service */
 int follow_xff = 0;            /**< Follow X-Forwarded-For: header */
+int home_specified = 0; /**< did the user specify a homedir? */
 extern void *context_loop(int);
 extern void *housekeeping_loop(void);
 extern pthread_mutex_t SessionListMutex;
 extern pthread_key_t MyConKey;
 
 extern void *context_loop(int);
 extern void *housekeeping_loop(void);
 extern pthread_mutex_t SessionListMutex;
 extern pthread_key_t MyConKey;
 
+char socket_dir[PATH_MAX];      /**< where to talk to our citadel server */
+static const char editor_absolut_dir[PATH_MAX]=EDITORDIR; /**< nailed to what configure gives us. */
+static char static_dir[PATH_MAX]; /**< calculated on startup */
+char  *static_dirs[]={ /**< needs same sort order as the web mapping */
+       (char*)static_dir,                  /** our templates on disk */
+       (char*)editor_absolut_dir           /** the editor on disk */
+};
+int ndirs=2; //sizeof(static_content_dirs);//sizeof(char *);
+
+/**
+ * Subdirectories from which the client may request static content
+ */
+char *static_content_dirs[] = {
+       "static",                     /** static templates */
+       "tiny_mce"                    /** the JS editor */
+};
+
+
 
 char *server_cookie = NULL; /**< our Cookie connection to the client */
 
 
 char *server_cookie = NULL; /**< our Cookie connection to the client */
 
@@ -494,7 +513,14 @@ int main(int argc, char **argv)
        int a, i;                       /**< General-purpose variables */
        char tracefile[PATH_MAX];
        char ip_addr[256];
        int a, i;                       /**< General-purpose variables */
        char tracefile[PATH_MAX];
        char ip_addr[256];
-       char *webcitdir = PREFIX;
+       char dirbuffer[PATH_MAX]="";
+       int relh=0;
+       int home=0;
+       int home_specified=0;
+       char relhome[PATH_MAX]="";
+       char webcitdir[PATH_MAX] = DATADIR;
+       char *hdir;
+       const char *basedir;
 #ifdef ENABLE_NLS
        char *locale = NULL;
        char *mo = NULL;
 #ifdef ENABLE_NLS
        char *locale = NULL;
        char *mo = NULL;
@@ -511,7 +537,16 @@ int main(int argc, char **argv)
 #endif
                switch (a) {
                case 'h':
 #endif
                switch (a) {
                case 'h':
-                       webcitdir = strdup(optarg);
+                       hdir = strdup(optarg);
+                       relh=hdir[0]!='/';
+                       if (!relh) safestrncpy(webcitdir, hdir,
+                                                                  sizeof webcitdir);
+                       else
+                               safestrncpy(relhome, relhome,
+                                                       sizeof relhome);
+                       /* free(hdir); TODO: SHOULD WE DO THIS? */
+                       home_specified = 1;
+                       home=1;
                        break;
                case 'i':
                        safestrncpy(ip_addr, optarg, sizeof ip_addr);
                        break;
                case 'i':
                        safestrncpy(ip_addr, optarg, sizeof ip_addr);
@@ -596,7 +631,25 @@ int main(int argc, char **argv)
        );
 #endif
 
        );
 #endif
 
-       lprintf(9, "Changing directory to %s\n", webcitdir);
+
+       /* calculate all our path on a central place */
+    /* where to keep our config */
+       
+#define COMPUTE_DIRECTORY(SUBDIR) memcpy(dirbuffer,SUBDIR, sizeof dirbuffer);\
+       snprintf(SUBDIR,sizeof SUBDIR,  "%s%s%s%s%s%s%s", \
+                        (home&!relh)?webcitdir:basedir, \
+             ((basedir!=webcitdir)&(home&!relh))?basedir:"/", \
+             ((basedir!=webcitdir)&(home&!relh))?"/":"", \
+                        relhome, \
+             (relhome[0]!='\0')?"/":"",\
+                        dirbuffer,\
+                        (dirbuffer[0]!='\0')?"/":"");
+       basedir=RUNDIR;
+       COMPUTE_DIRECTORY(socket_dir);
+       basedir=DATADIR;
+       COMPUTE_DIRECTORY(static_dir);
+       /** we should go somewhere we can leave our coredump, if enabled... */
+       lprintf(9, "Changing directory to %s\n", socket_dir);
        if (chdir(webcitdir) != 0) {
                perror("chdir");
        }
        if (chdir(webcitdir) != 0) {
                perror("chdir");
        }
index 5809b1aa9a3dd2440389dbce980773e68605bd46..503391411a863c16511a303bcf42ff63749c04f2 100644 (file)
@@ -1,4 +1,10 @@
 /* $Id$ */
 /* $Id$ */
+
+extern char *static_dirs[PATH_MAX];          /**< Web representation */
+extern char *static_content_dirs[PATH_MAX];  /**< Disk representation */
+extern int ndirs;
+extern char socket_dir[PATH_MAX];
+
 int client_getln(int sock, char *buf, int bufsiz);
 int client_read(int sock, char *buf, int bytes);
 int client_read_to(int sock, char *buf, int bytes, int timeout);
 int client_getln(int sock, char *buf, int bufsiz);
 int client_read(int sock, char *buf, int bytes);
 int client_read_to(int sock, char *buf, int bytes, int timeout);