Skip to content

Commit

Permalink
Adding index page for html folder
Browse files Browse the repository at this point in the history
  • Loading branch information
simonszu committed Mar 22, 2018
1 parent 0a59742 commit 92589e8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ RUN apt-get update \
&& cd / \
&& rm -r dosage

RUN mkdir /Comics
RUN mkdir /Comics && mkdir /templates
COPY download.sh .
COPY index.php .
COPY redirect.php /templates
COPY index.php /templates
COPY run.sh .
RUN chmod +x download.sh && chmod +x run.sh
COPY dosage-cron /etc/cron.d/
Expand Down
5 changes: 5 additions & 0 deletions download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ cd /
# Fetch all comics, including adult ones and create html and rss pages
/usr/local/bin/dosage -o html -o rss @ --adult

# Create index if not existing
if [ ! -f /Comics/html/index.php ]; then
cp /templates/index.php /Comics/html/index.php
fi

# Copy the RSS feed to the html folder
#rm /Comics/html/dailydose.rss
cp /Comics/dailydose.rss /Comics/html/dailydose.rss
Expand Down
17 changes: 15 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
<?php
header('Location: /html');
?>
$files = glob("*.*");
rsort($files);
echo "<ul>";
foreach($files as $filename) {
if ($filename == "index.php") {
continue;
}
echo "<li>";
echo "<a href='";
echo $filename;
echo "'>".$filename."</a>";
echo "<br>";
echo "</li>";
}
echo "<ul>";
3 changes: 3 additions & 0 deletions redirect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
header('Location: /html');
?>
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/bash

if [ ! -f /Comics/index.php ]; then
cp /index.php /Comics/index.php
cp /templates/redirect.php /Comics/index.php
fi

cron -f

0 comments on commit 92589e8

Please sign in to comment.