From 1cfa42bdad01ebca6f9f4f3a06d9ae57b62d31b2 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Thu, 16 Dec 2021 21:11:06 +0100 Subject: [PATCH 1/8] Remove unused `bad-words' global variable `bad-words' was introduced in 213fb2f25, but it is not really necessary. --- pastiche.scm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pastiche.scm b/pastiche.scm index 2cbce11..4c6a81a 100644 --- a/pastiche.scm +++ b/pastiche.scm @@ -92,7 +92,6 @@ (define espeak-available-languages '()) -(define bad-words '()) (define bad-words-irx #f) (define (is-it-spam? nick title paste) @@ -236,8 +235,8 @@ (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)))))) + (let ((bad-words (call-with-input-file bad-words-path read-lines))) + (set! bad-words-irx (irregex `(: (w/nocase (or ,@bad-words))))))) ;; The database needs to be initialised once (unless (file-exists? db-file) From 5b649495e7c18fb9edf292434d84d75765d60b51 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Thu, 16 Dec 2021 21:19:34 +0100 Subject: [PATCH 2/8] Remove `bad-words-irx' global variable Pass `bad-words-irx' as an argument to `is-it-spam?' --- pastiche.scm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pastiche.scm b/pastiche.scm index 4c6a81a..9badb17 100644 --- a/pastiche.scm +++ b/pastiche.scm @@ -92,9 +92,8 @@ (define espeak-available-languages '()) -(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))) @@ -234,9 +233,10 @@ (set! captchas (and use-captcha? (create-captchas num-captchas))) - (when bad-words-path - (let ((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) @@ -489,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)))) From ff16dc9f52407fbcd8f538c832101fb86c2315b8 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Thu, 16 Dec 2021 21:21:50 +0100 Subject: [PATCH 3/8] example-app.scm: nuke spurious trailing blank line --- example-app.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example-app.scm b/example-app.scm index 627aeab..97e23f6 100644 --- a/example-app.scm +++ b/example-app.scm @@ -11,4 +11,4 @@ (page-doctype doctype-html) (page-charset "UTF-8")) (handler)))) - + From 77c14136323fabf0e152b9910cf881a3f462d0f6 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Thu, 16 Dec 2021 21:26:55 +0100 Subject: [PATCH 4/8] example-app.scm: drop dependency on doctype What we use from doctype is so minimal it doesn't justify depending on an extra egg (and that egg is not in the dependencies list of pastiche). --- example-app.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example-app.scm b/example-app.scm index 97e23f6..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)))) From 4db25926bc8fbd5b846f04e69b2e6c9578d58eb3 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Thu, 16 Dec 2021 21:36:18 +0100 Subject: [PATCH 5/8] README.org: recommend `chicken-install -n' for development `chicken-install -n' will install all the required dependencies and compile pastiche, but won't install it. --- README.org | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.org b/README.org index cd8139d..e1d896d 100644 --- a/README.org +++ b/README.org @@ -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 From 3e6c0fcdb62088b7e621ae633ad0defd9a33d85c Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Thu, 16 Dec 2021 21:40:59 +0100 Subject: [PATCH 6/8] Remove tests/pastiche.db This is not required (it is deleted before tests start) and only generates a diff after tests end. Also delete the file after testing. --- tests/pastiche.db | Bin 24576 -> 0 bytes tests/run.scm | 1 + 2 files changed, 1 insertion(+) delete mode 100644 tests/pastiche.db diff --git a/tests/pastiche.db b/tests/pastiche.db deleted file mode 100644 index a8f43af105faf87e40ee0577f4f7e302c3fa1772..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24576 zcmeI)Z%f-i90%~bH2pKDcF&6J$%%}#tjxyhtT4vvR)*;Qb#)+alxuRe!L-rl6dw)h zi`WZr>^1B)`3Cl2d$P-=)u~ekLj?IAt^MV9NiM$+eRA=d_wUv`DOfw`ce!L`a*t3- zo-sxUG1WVz-lLXOL6jRcIts4%G|8j<_Qb?bk{UlI*)Q4rt9GDpVw>EMvXP9%WE}e zUFf&+zStK&TY256y{y%Xo_lZ-hm!YYv*icQ_DRkcd|!l3(R0srT+H-?K(ghvH_OGh z^_5rE`UYFAZN$SBnHr~1sHRf6^;t^1o+}Q*U0==NntV?NdRtX=uDGUsAr;N+G7;%# zGo34!>0stBE?v=+;n_oV%Dl=(?_uS2^`1MbpZ!rvk;ODoiG{&TBAv5sI@mpb0Z!19 z(FL4VGt49|9e%ijm3IT@vav0v)Zt;rDl*Hl6v&Fj(ib``ORpP8^E*70!YcSi zIyXI?89X?5k*60oyrvH;^~QR2ZTPi0?PhzS*V|%k8J6?W@I@96U1WOL=%Xu&Ob=J+ z&~$EUiVhy?(R411{~BjXk8}EbOo{_JI_YpjpZO&2s%gF-aJ7>@Oy>&|>Kj0_Ux|95 zK>z{}fB*y_009U<00Izz00ba#a{`+*^=az9S>r8tu2QK8d%<>E3rnSz+b*@r_MBaE z%e*!3@V3oezPQ9$&vUkUd|zSnNBbLRPr@DHc-&_l+4Y&a@6`{V#&-eY`Tr5g9^G7l z7#RW(fB*y_009U<00Izz00bZafsZszu6O>g7X70^00Izz00bZa0SG_<0uX=z1R!vW z1>*nzH%PW|i;F~Q5P$##AOHafKmY;|fB*y_0D)@|7!+tGYPrJ~C1x)?CS&%({9I*m zezCHYq%>iupWO4ilv0Bl1~m;rt$$qFpP=g4q+Y+TPGqVl@|n?!{wP*Y<};&p|0<>l zwUhphf7GEK^pGAd|Bp7KKK)z(wP7U4n5v& Date: Thu, 16 Dec 2021 21:53:22 +0100 Subject: [PATCH 7/8] README.org: typo fix and trailing empty lines cleanup --- README.org | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.org b/README.org index e1d896d..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 @@ -58,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. - - From 930ff13d41902ad0e995517c9e64d050855ee39d Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Thu, 16 Dec 2021 21:55:39 +0100 Subject: [PATCH 8/8] Add .gitignore --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .gitignore 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