Component variable

You are here: All Systems / lisppaste / variable

;;;; $Id: variable.lisp,v 1.54 2008/05/25 21:41:06 lisppaste Exp $
;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/variable.lisp,v $

;;;; See the LICENSE file for licensing information.

;;; This is the main file to edit to customize lisppaste to your
;;; site. In particular, the main variables are at the top, which
;;; define how lisppaste knows which site it is running on, and how to
;;; generate links to itself. There are two ways to run lisppaste:
;;; naked, and behind a proxying apache. When running naked, you can
;;; leave much of this file as-is, and change *internal-http-port* and
;;; *external-http-port* to the port you want it to run on, and
;;; *paste-site-name* to the hostname it is running on.

;;; When running behind a proxy, set *internal-http-port* to the port
;;; it will listen for requests from Apache, but set
;;; *external-http-port* to 80. Set *paste-site-name* to a hostname
;;; that lisppaste is running on, and comment out the line in
;;; *paste-external-url* as indicated.

;;; There are a few other options below, but the defaults should work
;;; well.

(in-package :lisppaste)

(defparameter *internal-http-port* 8080
  "Port lisppaste's araneida will listen on for requests from Apache."
)

(defparameter *external-http-port* 80
  "Port lisppaste's araneida will listen on for requests from remote clients."
)


(defparameter *paste-site-name* "paste.lisp.org"
  "Website we are running on (used for creating links)."
)


(defparameter *paste-external-url*
  (merge-url
   (make-url :scheme "http"
                      :host *paste-site-name*
                      ;;; comment out this next line when running
                     ;;; behind a proxying apache
                      #| :port *external-http-port* |#
                      
)
"/"
)
)


(defparameter *old-url* (merge-url
                         (make-url :scheme "http"
                                            :host "www.common-lisp.net"
)

                         "/paste/"
)
)


(defvar *meme-links* t) ; whether to link to meme IRC logs, probably
                          ; only useful for freenode's lisppaste

(defvar *irc-network-name* "Freenode") ; the name of the IRC network
                                       ; lisppaste is running on; can
                                       ; be ignored when not running
                                       ; with an IRC connection

(defparameter *owner-email* "lisppaste-requests@common-lisp.net") ; the owner of this lisppaste

(defparameter *ads*
  (<div>
   (<ul>
    (<li> (<a href="http://planet.lisp.org/"> "Planet Lisp"))
    (<li> (<a href="http://www.gigamonkeys.com/book/">
              "Practical Common Lisp - learn Lisp!"
)
)
)
)
)
; gratuitous promotions

(defparameter *ohloh*
  (<div class= "ohloh">
        (<script type= "text/javascript" src= "http://www.ohloh.net/projects/26110/widgets/project_users">)
)
)


(defparameter *allowed-content-types*
  '("text/plain" "image/svg+xml" "text/html" "application/xhtml+xml")
)


(defparameter *paste-maximum-size* 51200) ; in bytes

(defparameter *pastes-per-page* 50) ; for the paste list

(defparameter *banned-ips*
  '("69.11.238.252" "168.143.113.138"
    "83.216.146.102"
    "206.159.155.203" "66.122.165.201"
    "165.121.144.165" "203.70.5.30"
    "195.225.176.77" "195.225.176.73"
    "210.127.227.69" "68.214.30.130"
    "81.95.146.162" "4.235.193.37"
    
)
)


(defparameter *banned-paste-titles*
  '("Free Ringtones" "My Site" "Nibelan" "My homepage")
)


(defparameter *banned-paste-users*
  '("RuleZ005" "Viag@Viag.com")
)


(defparameter *banned-content-regexps*
  '("Free.*Ringtones" "(?s)a href=.*\\[url" "(?s)A href.*\\[URL" "(?s)\\[url=http.*\\].*a href" "(?s)valium.*viagra" "(?s)Xanax.*Cialis" "(?s)(<[aA] href=\" http:[^\"]+ \">[^<]+</[aA]>(\\n|\\r)*){2}" "(?s)\\[URL.*\\[URL.*\\[URL" "(?i)Cathode Ray Terrorists Proudly Bring you")
)


(defparameter *base-path*
  (asdf:component-pathname (asdf:find-system :lisppaste))
)


(defparameter *ban-log-file*
  (merge-pathnames "ban-log"
                   (make-pathname
                    :directory
                    (pathname-directory
                     *base-path*
)
)
)
)

                                        ; where logs of attempts by
                                       ; banned users to paste go

(defparameter *event-log-file*
  (merge-pathnames "event-log"
                   (make-pathname
                    :directory
                    (pathname-directory
                     *base-path*
)
)
)
)

                                        ; where normal events are
                                       ; logged

(defparameter *no-channel-pastes* t) ; whether to allow pastes that
                                       ; don't get announced on a
                                       ; channel

(defparameter *serve-source* t)

;; once every this often, clear out the "used" captchas
(defparameter *used-captcha-release-time* (* 60 60 24))

;; These are ripemd 160-bit hashes of administrator passwords
(defparameter *administrator-passwords* '("c549ae1a463872b01add5694bd3954026ad3d565"))

;; Annotations of pastes older than this won't be allowed
(defparameter *annotate-moldy* (* 60 60 24 30))

;; You shouldn't need to edit below this line.
;; LINE

(defparameter *hashed-administrator-passwords*
  (mapcar #'hex-hash-to-vector *administrator-passwords*)
)


(defparameter *display-paste-url*
  (merge-url *paste-external-url* "display/")
)


(defparameter *new-paste-url*
  (merge-url *paste-external-url* "new")
)


(defparameter *list-paste-url*
  (merge-url *paste-external-url* "list")
)


(defparameter *submit-paste-url*
  (merge-url *paste-external-url* "submit")
)


(defparameter *rss-url*
  (merge-url *paste-external-url* "list.rss")
)


(defparameter *rss-full-url*
  (merge-url *paste-external-url* "list-full.rss")
)


(defparameter *syndication-url*
  (merge-url *paste-external-url* "syndication")
)


(defparameter *stats-url*
  (merge-url *paste-external-url* "stats")
)


(defparameter *css-url*
  (merge-url *paste-external-url* "lisppaste.css")
)


(defparameter *recent-url*
  (merge-url *paste-external-url* "recent")
)


(defparameter *email-redirect-url*
  (merge-url *paste-external-url* "email")
)


(defparameter *channel-select-url*
  (merge-url *paste-external-url* "channels")
)


(defparameter *404-urls*
  (list (merge-url *paste-external-url* "favicon.ico")
        (merge-url *paste-external-url* "robots.txt")
)
)


(defparameter *main-system-server-url* (merge-url *paste-external-url*
                                                  "system-server/"
)
)


(defparameter *show-component-url* (merge-url *paste-external-url*
                                              "system-server/show/"
)
)


(defvar *paste-listener*
  (let ((fwd-url (copy-url *paste-external-url*))
        (fwd-old-url (copy-url *old-url*))
)

    (setf (url-port fwd-url) *internal-http-port*)
    ;; temporary fix!
   (setf (url-host fwd-url) "127.0.0.1")
    (setf (url-port fwd-old-url) *internal-http-port*)
    (make-instance #+sbcl 'serve-event-reverse-proxy-listener
                   #-sbcl 'threaded-reverse-proxy-listener
                   :translations
                   `((,(urlstring *paste-external-url*)
                      ,(urlstring fwd-url)
)

                     (,(urlstring *old-url*)
                      ,(urlstring fwd-old-url)
)
)

                   :default-hostname *paste-site-name*
                   :address #(127 0 0 1)
                   :port (url-port fwd-url)
)
)
)


(defvar *default-nickname* "devpaste")
(defvar *default-irc-server* "irc.freenode.net")
(defvar *default-irc-server-port* 6667)
(defvar *default-channel* "#lisppaste")

(defvar *pastes* nil)
(defvar *paste-counter* 0)
(defvar *channels* '("None"))

(defvar *paste-file*
  (merge-pathnames "pastes.lisp-expr"
                   (make-pathname
                    :directory
                    (pathname-directory
                     *base-path*
)
)
)
)


(defparameter *paste-path*
  (merge-pathnames (make-pathname :directory '(:relative "pastes"))
                   (make-pathname
                    :directory
                    (pathname-directory
                     *base-path*
)
)
)
)


(defparameter *times-file-root*
  (make-pathname
   :directory
   (pathname-directory
    *base-path*
)
)
)


(defvar *boot-time* 0)

(defvar *coloring-type-defaults* (make-hash-table :test #'equalp))

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.