Compare commits
No commits in common. "43e9ccd887d1ca09e5bbc4af19faa3352ff2114c" and "1179552dbe50b0e97863533729d400289d404249" have entirely different histories.
43e9ccd887
...
1179552dbe
|
@ -2,6 +2,7 @@ FROM docker.io/perl:5.36
|
|||
|
||||
# Move it
|
||||
WORKDIR /opt
|
||||
COPY assets/ ./assets/
|
||||
COPY lib/ ./lib/
|
||||
COPY migrations/ ./migrations/
|
||||
COPY public/ ./public/
|
||||
|
@ -14,6 +15,9 @@ COPY post_text.conf .
|
|||
# Dependency time
|
||||
RUN apt-get update
|
||||
RUN apt-get -y upgrade
|
||||
# Work around for test failing due to headers being lowercase now that
|
||||
# cpan.org is on HTTP/2
|
||||
RUN cpanm --notest Net::HTTP
|
||||
RUN cpanm --installdeps .
|
||||
|
||||
# Finish setting up the environment
|
||||
|
|
11
README.md
11
README.md
|
@ -19,7 +19,8 @@ should be YAML or XML or something better suited.
|
|||
|
||||
Run it in development mode:
|
||||
|
||||
morbo -w public/ -w lib/ -w templates/ -w script/ script/post_text
|
||||
morbo -w assets/css/ -w public/ -w lib/ -w templates/ \
|
||||
-w script/ script/post_text
|
||||
|
||||
Now try requesting http://localhost:3000
|
||||
|
||||
|
@ -60,8 +61,15 @@ tests locally:
|
|||
|
||||
## TODOs
|
||||
|
||||
1. Re-visit this TODO list because it doesn't seem like I'm gunna
|
||||
bother with all new posts flagged mode lmao. There's a CAPTCHA now
|
||||
so it's not as painfully open...
|
||||
1. Deprecate/remove AssetPack dependency
|
||||
1. Automate the holiday backgrounds with JS
|
||||
1. Test JS with LibreJS or something like that (I don't like RMS I
|
||||
just want free JS!!)
|
||||
1. "All new posts flagged" mode (require approval for new posts)
|
||||
1. Tests for mod-only user?
|
||||
|
||||
## Crazy future ideas
|
||||
|
||||
|
@ -70,7 +78,6 @@ tests locally:
|
|||
1. Is `remark_tally` counting hidden remarks? Tried to add a `WHERE
|
||||
NOT hidden_status` but that returns null, probably need a different
|
||||
`JOIN` which may not be worth the trouble/processing
|
||||
1. Nah it needs a subquery instead of just `COUNT(*)` (dude trust me)
|
||||
1. Implement tripcodes (moving this down in priority due to complexity...)
|
||||
1. Post thread via SMS (twil.io??)
|
||||
|
||||
|
|
12
assets/assetpack.db
Normal file
12
assets/assetpack.db
Normal file
|
@ -0,0 +1,12 @@
|
|||
[css-min:css/PostText.css]
|
||||
checksum=3698d7bf52
|
||||
format=css
|
||||
minified=1
|
||||
[css-min:https://unpkg.com/98.css]
|
||||
checksum=4f089bc53f
|
||||
format=css
|
||||
minified=1
|
||||
[sass:sass/post_text.scss]
|
||||
checksum=ecda188939
|
||||
format=css
|
||||
minified=0
|
5
assets/assetpack.def
Normal file
5
assets/assetpack.def
Normal file
|
@ -0,0 +1,5 @@
|
|||
! app.css
|
||||
< https://unpkg.com/normalize.css@8.0.1/normalize.css
|
||||
< css/elements.css
|
||||
< css/simple.css
|
||||
< css/nested.css
|
|
@ -28,6 +28,14 @@
|
|||
|
||||
body {
|
||||
background-image: url('/images/background_stars_anm.gif');
|
||||
/* Was feelin this for September idk */
|
||||
/* background-image: url('/images/topwwbackground.gif'); */
|
||||
/* Spooky time! */
|
||||
/* background-image: url('/images/halloween_background_1.gif'); */
|
||||
/* Winter/snow */
|
||||
/* background-image: url('/images/jwsfp1.gif'); */
|
||||
/* Christmas */
|
||||
/* background-image: url('/images/christmas.gif'); */
|
||||
width: 95vmin;
|
||||
margin: 0 auto;
|
||||
font-family: 'w95fa', sans-serif;
|
3
cpanfile
3
cpanfile
|
@ -1,9 +1,12 @@
|
|||
requires 'Mojolicious';
|
||||
requires 'Mojo::Pg';
|
||||
requires 'Mojolicious::Plugin::TagHelpers::Pagination';
|
||||
requires 'Mojolicious::Plugin::AssetPack';
|
||||
requires 'Crypt::Passphrase::Argon2';
|
||||
requires 'Date::Format';
|
||||
requires 'XML::RSS';
|
||||
requires 'CSS::Minifier::XS';
|
||||
requires 'Text::Markdown';
|
||||
requires 'HTML::Restrict';
|
||||
requires 'IO::Socket::SSL';
|
||||
requires 'Roman::Unicode';
|
||||
|
|
|
@ -18,6 +18,7 @@ use PostText::Model::Page;
|
|||
sub startup($self) {
|
||||
$self->plugin('Config');
|
||||
$self->plugin('TagHelpers::Pagination');
|
||||
$self->plugin(AssetPack => {pipes => [qw{Css Combine}]});
|
||||
|
||||
# Helpers
|
||||
$self->helper(pg => sub ($c) {
|
||||
|
@ -107,6 +108,8 @@ sub startup($self) {
|
|||
$self->thread->max_pages($max_thread_pages)
|
||||
}
|
||||
|
||||
$self->asset->process;
|
||||
|
||||
push @{$self->commands->namespaces}, 'PostText::Command';
|
||||
|
||||
# Begin routing
|
||||
|
@ -231,10 +234,6 @@ sub startup($self) {
|
|||
->to('moderator#mod_reset')
|
||||
->name('mod_reset');
|
||||
|
||||
$moderator->get('/list')
|
||||
->to('moderator#list')
|
||||
->name('mod_list');
|
||||
|
||||
my $mod_thread = $moderator->any('/thread');
|
||||
|
||||
$mod_thread->get('/unflag/:thread_id', [thread_id => qr/\d+/])
|
||||
|
|
|
@ -344,12 +344,4 @@ sub remark_by_id($self) {
|
|||
$self->render;
|
||||
}
|
||||
|
||||
sub list($self) {
|
||||
my $moderators = $self->moderator->list;
|
||||
|
||||
$self->stash(moderators => $moderators);
|
||||
|
||||
$self->render;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -259,19 +259,4 @@ sub remark_by_id($self, $remark_id) {
|
|||
END_SQL
|
||||
}
|
||||
|
||||
sub list($self) {
|
||||
my $date_format = $self->date_format;
|
||||
|
||||
$self->pg->db->query(<<~'END_SQL', $date_format)->hashes;
|
||||
SELECT moderator_id AS id,
|
||||
moderator_name AS name,
|
||||
email_addr,
|
||||
TO_CHAR(creation_date, $1) AS creation_date,
|
||||
TO_CHAR(last_login_date, $1) AS last_login_date,
|
||||
lock_status,
|
||||
admin_status
|
||||
FROM moderators;
|
||||
END_SQL
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
(function () {
|
||||
const bodyStyle = document.body.style;
|
||||
|
||||
function setImage(url) {
|
||||
bodyStyle.backgroundImage = "url('" + url + "')";
|
||||
}
|
||||
|
||||
switch (new Date().getMonth()) {
|
||||
case 0:
|
||||
setImage('/images/jwsfp1.gif');
|
||||
break;
|
||||
case 3:
|
||||
setImage('/images/background2.gif');
|
||||
break;
|
||||
case 9:
|
||||
setImage('/images/halloween_background_1.gif');
|
||||
break;
|
||||
case 10:
|
||||
setImage('/images/topwwbackground.gif');
|
||||
break;
|
||||
case 11:
|
||||
setImage('/images/christmas.gif');
|
||||
break;
|
||||
}
|
||||
})();
|
|
@ -5,8 +5,8 @@ use Test::Mojo;
|
|||
my $t = Test::Mojo->new('PostText');
|
||||
|
||||
my %valid_login = (
|
||||
email => 'swaggboi@gangstalking.agency',
|
||||
password => 'i also like to party'
|
||||
email => 'swaggboi@slackware.uk',
|
||||
password => 'i like to party'
|
||||
);
|
||||
|
||||
my %invalid_login = (
|
||||
|
@ -114,12 +114,6 @@ subtest Login => sub {
|
|||
->element_exists('form input[name="password"]')
|
||||
};
|
||||
|
||||
subtest List => sub {
|
||||
$t->get_ok('/moderator/list')
|
||||
->status_is(200)
|
||||
->text_like(h2 => qr/Moderator List/)
|
||||
};
|
||||
|
||||
# Mod session ends
|
||||
$t->get_ok('/logout')
|
||||
->status_is(302)
|
||||
|
@ -133,7 +127,6 @@ subtest Login => sub {
|
|||
->element_exists_not('a[href*="/unflag/1"]' )
|
||||
->element_exists_not('a[href*="/moderator/flagged"]')
|
||||
->element_exists_not('a[href*="/moderator/hidden"]' )
|
||||
->element_exists_not('a[href*="/moderator/list"]' )
|
||||
->element_exists_not('a[href*="/logout"]' );
|
||||
|
||||
$t->get_ok('/remark/single/1')
|
||||
|
@ -143,7 +136,6 @@ subtest Login => sub {
|
|||
->element_exists_not('a[href*="/unflag/1"]' )
|
||||
->element_exists_not('a[href*="/moderator/flagged"]')
|
||||
->element_exists_not('a[href*="/moderator/hidden"]' )
|
||||
->element_exists_not('a[href*="/moderator/list"]' )
|
||||
->element_exists_not('a[href*="/logout"]' );
|
||||
|
||||
$t->get_ok('/moderator/flagged')
|
||||
|
@ -153,10 +145,6 @@ subtest Login => sub {
|
|||
$t->get_ok('/moderator/hidden')
|
||||
->status_is(302)
|
||||
->header_like(Location => qr/login/);
|
||||
|
||||
$t->get_ok('/moderator/list')
|
||||
->status_is(302)
|
||||
->header_like(Location => qr/login/);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -29,10 +29,7 @@
|
|||
content="<%= url_for('/images/logo.png')->to_abs %>">
|
||||
<meta name="twitter:image:alt"
|
||||
content="Post::Text logo; a small nerdy anime girl giving a V sign">
|
||||
<%= stylesheet '/css/elements.css' %>
|
||||
<%= stylesheet '/css/simple.css' %>
|
||||
<%= stylesheet '/css/nested.css' %>
|
||||
<%= javascript '/js/background.js', defer => undef %>
|
||||
<%= asset 'app.css' %>
|
||||
</head>
|
||||
<body>
|
||||
<header class="header">
|
||||
|
@ -51,7 +48,6 @@
|
|||
<%= link_to Flagged => flagged_list => (class => 'click') %>
|
||||
<%= link_to Hidden => hidden_list => (class => 'click') %>
|
||||
<%= link_to Reset => mod_reset => (class => 'click') %>
|
||||
<%= link_to List => mod_list => (class => 'click') %>
|
||||
<%= link_to Logout => mod_logout => (class => 'click') %>
|
||||
</nav>
|
||||
<% } =%>
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
% layout 'default';
|
||||
% title 'Moderator List';
|
||||
<h2 class="page-title"><%= title %></h2>
|
||||
<main class="page-body">
|
||||
<% if (scalar @{$moderators}) { =%>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Moderator ID</th>
|
||||
<th>Moderator Name</th>
|
||||
<th>Email Address</th>
|
||||
<th>Creation Date</th>
|
||||
<th>Last Login Date</th>
|
||||
<th>Locked?</th>
|
||||
<th>Admin?</th>
|
||||
</tr>
|
||||
<% for my $moderator (@{$moderators}) { %>
|
||||
<tr>
|
||||
<td><%= $moderator->{'id' } %></td>
|
||||
<td><%= $moderator->{'name' } %></td>
|
||||
<td><%= $moderator->{'email_addr' } %></td>
|
||||
<td><%= $moderator->{'creation_date' } %></td>
|
||||
<td><%= $moderator->{'last_login_date'} %></td>
|
||||
<td><%= $moderator->{'lock_status' } %></td>
|
||||
<td><%= $moderator->{'admin_status' } %></td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</table>
|
||||
<% } =%>
|
||||
</main>
|
Loading…
Reference in a new issue