diff options
author | mms <git@sapka.me> | 2025-01-05 22:34:55 +0100 |
---|---|---|
committer | mms <git@sapka.me> | 2025-01-05 22:34:55 +0100 |
commit | bfd8209ad0d80b5027bea8a1a095dadc8bffdc61 (patch) | |
tree | 1d4ec6d63dd3b4a1f788ec340a0fba3cd48b3dea /new/splash | |
parent | 628fcf941c322dd0ed24a643c58394392484740e (diff) |
Diffstat (limited to 'new/splash')
-rw-r--r-- | new/splash/assets/images/background.png | bin | 0 -> 3909 bytes | |||
-rw-r--r-- | new/splash/assets/images/buttons/org.dillo.gif | bin | 0 -> 1899 bytes | |||
-rw-r--r-- | new/splash/assets/images/buttons/org.freebsd.gif | bin | 0 -> 999 bytes | |||
-rw-r--r-- | new/splash/assets/images/new.gif | bin | 0 -> 141 bytes | |||
-rwxr-xr-x | new/splash/bin/build.rb | 12 | ||||
-rw-r--r-- | new/splash/lib/splash/builder.rb | 6 | ||||
-rw-r--r-- | new/splash/lib/splash/processors/splash_processor.rb | 53 | ||||
-rw-r--r-- | new/splash/output/background.png | bin | 0 -> 3909 bytes | |||
-rw-r--r-- | new/splash/output/new.gif | bin | 0 -> 141 bytes | |||
-rw-r--r-- | new/splash/output/org.dillo.gif | bin | 0 -> 1899 bytes | |||
-rw-r--r-- | new/splash/output/org.freebsd.gif | bin | 0 -> 999 bytes | |||
-rw-r--r-- | new/splash/pages/.dir-locals.el | 7 | ||||
-rw-r--r-- | new/splash/pages/background.png | 1 | ||||
-rw-r--r-- | new/splash/pages/index.html.erb | 145 |
14 files changed, 217 insertions, 7 deletions
diff --git a/new/splash/assets/images/background.png b/new/splash/assets/images/background.png Binary files differnew file mode 100644 index 0000000..11f85e6 --- /dev/null +++ b/new/splash/assets/images/background.png diff --git a/new/splash/assets/images/buttons/org.dillo.gif b/new/splash/assets/images/buttons/org.dillo.gif Binary files differnew file mode 100644 index 0000000..850d4df --- /dev/null +++ b/new/splash/assets/images/buttons/org.dillo.gif diff --git a/new/splash/assets/images/buttons/org.freebsd.gif b/new/splash/assets/images/buttons/org.freebsd.gif Binary files differnew file mode 100644 index 0000000..cd41141 --- /dev/null +++ b/new/splash/assets/images/buttons/org.freebsd.gif diff --git a/new/splash/assets/images/new.gif b/new/splash/assets/images/new.gif Binary files differnew file mode 100644 index 0000000..b06fb07 --- /dev/null +++ b/new/splash/assets/images/new.gif diff --git a/new/splash/bin/build.rb b/new/splash/bin/build.rb index 404431f..1439dd6 100755 --- a/new/splash/bin/build.rb +++ b/new/splash/bin/build.rb @@ -6,6 +6,14 @@ require_relative '../../bin/builder' builder_class = Crys::Splash::Builder output_dir = "#{File.dirname(File.dirname(__FILE__))}/output" -file_path = "#{File.dirname(File.dirname(__FILE__))}/pages/#{@options[:filepath]}" +#file_path = "#{File.dirname(File.dirname(__FILE__))}/pages/#{@options[:filepath]}" +image_dir = "#{File.dirname(File.dirname(File.expand_path(__FILE__)))}/assets/images" -Crys::BuilderRunner.new(file_path: file_path, output_dir: output_dir, builder_class: builder_class).run +file_path=@options[:filepath] + +Crys::BuilderRunner.new( + file_path: file_path, + output_dir: output_dir, + builder_class: builder_class, + image_dir: image_dir +).run diff --git a/new/splash/lib/splash/builder.rb b/new/splash/lib/splash/builder.rb index 5a737e9..7b0f13f 100644 --- a/new/splash/lib/splash/builder.rb +++ b/new/splash/lib/splash/builder.rb @@ -1,8 +1,14 @@ # frozen_string_literal: true +require_relative "processors/splash_processor" + module Crys module Splash class Builder < Crys::Builder + + def html_processor + Crys::Splash::SplashProcessor + end end end end diff --git a/new/splash/lib/splash/processors/splash_processor.rb b/new/splash/lib/splash/processors/splash_processor.rb new file mode 100644 index 0000000..463dd65 --- /dev/null +++ b/new/splash/lib/splash/processors/splash_processor.rb @@ -0,0 +1,53 @@ +require "yaml" + +module Crys + module Splash + class SplashProcessor < Crys::HtmlProcessor + def not_real + [ + "doctor", + "starfleet officer", + "magician", + "hacker", + "emperor of an evil galaxy", + "replicant", + "computer", + "evil genius" + ].sample + end + + def update_badge(url_part) + @main_rss = fetch_rss(name: :main) + if @main_rss.items.last(20).any? { |it| it.link.include? url_part } + new_badge + end + end + + def more_update_badge(name:) + path = case name + when :bookmarks + "/assets/more/bookmarks.yml" + when :links + "/assets/more/links.yml" + end + + yaml = YAML.load_file(project_root + path) + _, vals = yaml.first + last_added = Time.parse(vals.last.fetch("date")) + + if (Time.now - last_added) / (24 * 60* 60) < 30 + new_badge + end + end + + + def new_badge + image = process_image(file: "new.gif") + code = ERB.new <<-EOF +<img src="<%=image.relative_path%>" width="32" height="22" class="new-badge" alt="NEW"> +EOF + code.result(binding) + end + end + end +end diff --git a/new/splash/output/background.png b/new/splash/output/background.png Binary files differnew file mode 100644 index 0000000..11f85e6 --- /dev/null +++ b/new/splash/output/background.png diff --git a/new/splash/output/new.gif b/new/splash/output/new.gif Binary files differnew file mode 100644 index 0000000..b06fb07 --- /dev/null +++ b/new/splash/output/new.gif diff --git a/new/splash/output/org.dillo.gif b/new/splash/output/org.dillo.gif Binary files differnew file mode 100644 index 0000000..850d4df --- /dev/null +++ b/new/splash/output/org.dillo.gif diff --git a/new/splash/output/org.freebsd.gif b/new/splash/output/org.freebsd.gif Binary files differnew file mode 100644 index 0000000..cd41141 --- /dev/null +++ b/new/splash/output/org.freebsd.gif diff --git a/new/splash/pages/.dir-locals.el b/new/splash/pages/.dir-locals.el index 4e2be03..22b2f46 100644 --- a/new/splash/pages/.dir-locals.el +++ b/new/splash/pages/.dir-locals.el @@ -1 +1,6 @@ -((nil . ((add-hook 'after-save-hook ('message :a)))) + +((nil + . ((eval . + (add-hook 'after-save-hook (lambda () (message (shell-command-to-string (format "../bin/build.rb -f%s" (buffer-file-name)))))) + )))) + diff --git a/new/splash/pages/background.png b/new/splash/pages/background.png new file mode 100644 index 0000000..22d26b7 --- /dev/null +++ b/new/splash/pages/background.png @@ -0,0 +1 @@ +#<File:0x0000293dcce70da0>
\ No newline at end of file diff --git a/new/splash/pages/index.html.erb b/new/splash/pages/index.html.erb index d033c90..e5ee6f6 100644 --- a/new/splash/pages/index.html.erb +++ b/new/splash/pages/index.html.erb @@ -1,9 +1,146 @@ -<html> +<!DOCTYPE html> +<html lang="en"> <head> - <title>It works!</title> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta charset="utf-8"> + <title>Crys SITE</title> + <link rel="canonical" href="https://crys.site"> + <meta name="robots" content="index, follow"> + <meta property="og:title" content="Crys Site"> + <meta property="og:type" content="website"> + <meta property="og:url" content="https://crys.site"> + <meta property="og:description" content="Michal's personal website"> + + <meta name="fediverse:creator" content="@mms@bsd.cafe"> + <link rel="me" href="https://mastodon.bsd.cafe/@mms" title="@mms on bsd.cafe"> + + <style> + body { + text-align: center; + background-color: #c2c2c2; + background-image: url("<%= process_image(file: "background.png").relative_path %>"); + color: #000; + } + + a { + color: #000; + } + ol { + padding: 0; + } + + ol li{ + list-style-type: none; + } + + img.webutton { + border: 0; + text-decoration: none; + color: #c2c2c2; + margin: 10px; + } + + </style> + </head> <body> - <h1>Test</h1> - Last update: <%= Time.now %> + + <h1>Crys SITE</h1> + + <p> + Hi! + I'm Michal and this is my personal webpage. + </p> + + <p> + The World Wide Web used to be fun, scrappy, and ours; let's bring it back. + </p> + + <p> + <b>NOTE: I am not a real <%= not_real %>, and I can be wrong sometimes</b>. + + </p> + + + <hr> + <p> + Updated <%= Time.now.strftime("%B %d, %Y") %> + </p> + + <hr> + <h2>Contents</h2> + + <h3>Main sections</h3> + + + <nav> + <ol> + <li><a href="/blog">My personal blog</a> + <%= update_badge("blog")%> + <li><a href="/bsd">Guides on using FreeBSD on a PC</a> + <%= update_badge("bsd")%> + <li><a href="/emacs">Guides on using Emacs for not obvious tasks</a> + <%= update_badge("emacs")%> + <li><a href="/unix-history">A short Unix History</a> + <%= update_badge("unix-history")%> + <li><a href="/reviews">Reviews of narrative works</a> + <%= update_badge("reviews")%> + <li><a href="/star-trek">Star Trek fansite</a> + <%= update_badge("star-trek")%> + </ol> + + + <h3>Projects</h3> + + <ol> + <li><a href="/projects/chotto">Chotto</a> - a initial tagging system for Notmuch + <%= update_badge("chotto")%> + </ol> + + + <h3>Mirrors</h3> + <ol> + <li><a href="/mirror/userfriendly">User Friendly comic mirror</a> + </ol> + + <h3>Even more</h3> + + + <ol> + <li><a href="/more/bookmarks/">Bookmarks</a> to cool things on the web + <%= more_update_badge(name: :bookmarks)%> + <li><a href="/more/links/">Links</a> to other sites + <%= more_update_badge(name: :links)%> + <li><a href="/more/irc/">IRC Channel</a> of this site + <li><a href="/more/contact/">Contact</a> + <li><a href="/more/now/">Now</a> + <li><a href="/more/uses/">Uses</a> + </ol> + +</nav> + <hr> + + + <h2>Recent updates</h2> + + <nav> + <ol> + <% fetch_rss(name: :main).items.first(10).each do |item| %> + <li><a href="<%=item.link%>"><%= item.title %></a> (<%=item.date.strftime("%B %d, %Y")%>) + <% end %> + </ol> + </nav> + + + <hr> + <p> + This is self-hosted site. + You are connected live to my living room. + </p> + + <div> + <%= webbutton(file: "org.freebsd.gif", url: "https://www.freebsd.org/", alt: "Powered by FreeBSD") %> + <%= webbutton(file: "org.dillo.gif", url: "https://www.dillo.org/", alt: "Optimized for Dillo") %> + </div> </body> </html> |