diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c9b32e6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +paste.db +pastiche.build.sh +pastiche.import.* +pastiche.install.sh +pastiche.link +pastiche.so +pastiche.static.o diff --git a/README.org b/README.org index cd8139d..aa900de 100644 --- a/README.org +++ b/README.org @@ -13,7 +13,7 @@ Using a recent CHICKEN scheme version (>4.6.0), do 2. cd pastiche 3. chicken-install -s -This will fetch all dependencies and installs pastiche and awful. +This will fetch all dependencies and install pastiche and awful. To run it load the example-app in awful: $ awful --development-mode example-app @@ -24,12 +24,9 @@ It is also possible to run pastiche without having to install the module. This is useful if you are working on pastiche itself. To do so install all the required modules first: - $ chicken-install awful:0.39 awful-sql-de-lite:0.4 simple-sha1:0.1 colorize miscmacros utf8 + $ chicken-install -n $ awful --development-mode example-app.scm -/Note:/ The versions required may have changed in the meantime, please -have a look at the depends clause in the pastiche.meta file. - * License Copyright © 2011 Christian Kellermann @@ -61,5 +58,3 @@ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - diff --git a/example-app.scm b/example-app.scm index 627aeab..545d04e 100644 --- a/example-app.scm +++ b/example-app.scm @@ -1,6 +1,6 @@ (include "pastiche.scm") (import pastiche) -(import awful doctype) +(import awful) (pastiche "/" "paste.db" awful-settings: @@ -8,7 +8,7 @@ (parameterize ((debug-file "/tmp/paste") (page-css "chicken.css") - (page-doctype doctype-html) + (page-doctype "") (page-charset "UTF-8")) (handler)))) - + diff --git a/pastiche.scm b/pastiche.scm index 2cbce11..9badb17 100644 --- a/pastiche.scm +++ b/pastiche.scm @@ -92,10 +92,8 @@ (define espeak-available-languages '()) -(define bad-words '()) -(define bad-words-irx #f) - -(define (is-it-spam? nick title paste) +(define (is-it-spam? nick title paste bad-words-irx) + ;; bad-words-irx is either a regex or #f (define (url? s) (and-let* ((uri (uri-reference s)) (s (uri-scheme uri))) @@ -235,9 +233,10 @@ (set! captchas (and use-captcha? (create-captchas num-captchas))) - (when bad-words-path - (set! bad-words (call-with-input-file bad-words-path read-lines)) - (set! bad-words-irx (irregex `(: (w/nocase (or ,@bad-words)))))) + (define bad-words-irx + (and bad-words-path + (let ((bad-words (call-with-input-file bad-words-path read-lines))) + (irregex `(: (w/nocase (or ,@bad-words))))))) ;; The database needs to be initialised once (unless (file-exists? db-file) @@ -490,7 +489,7 @@ (list nick title time paste)))) (cond ((string-null? paste) (bail-out "I am not storing empty pastes.")) - ((is-it-spam? nick title paste) + ((is-it-spam? nick title paste bad-words-irx) (when ($ 'notify-irc) (send-to-irc (string-append "SPAM! SPAM! SPAM! by " nick))) `((h2 (@ (align "center")) "Thanks for your paste!") (p "Hi " ,nick ", thanks for pasting: " (em ,title) (br)))) diff --git a/tests/pastiche.db b/tests/pastiche.db deleted file mode 100644 index a8f43af..0000000 Binary files a/tests/pastiche.db and /dev/null differ diff --git a/tests/run.scm b/tests/run.scm index c7adda1..fadb96c 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -23,4 +23,5 @@ (lambda () (load "client.scm"))) +(delete-file* pastiche-db) (test-exit)