* made directories configurable from start.
* make debian package build work again.
# usual unix way would be here: $(datadir)/$(PACKAGE)
#STATIC_DIR=@STATIC_DIR@
-DIRS=tiny_mce static
+DIRS= static
+EDITOR_DIRS=tiny_mce
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
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
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
----------
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)
+
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_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 )
+
echo ------------------------------------------------------------------------
echo 'zlib compression: ' $ok_zlib
echo 'Calendar support: ' $ok_libical
--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-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
dh_installdocs
dh_installexamples
# dh_install
-# dh_installmenu
dh_installdebconf
# dh_installlogrotate
-# dh_installemacsen
-# dh_installpam
-# dh_installmime
# dh_installinit
# dh_installcron
-# dh_installinfo
dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
-# dh_perl
-# dh_python
-# dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol
#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
/** 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;
}
}
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;
+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 */
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;
#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);
);
#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");
}
/* $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);