Commit graph

44 commits

Author SHA1 Message Date
10caf581ad remove the sus println 2023-07-12 23:38:39 -07:00
60c2ac15e7 move asset stuff to its own crate
this should seperate out the asset handling code, which was practically
its own module inside the main codebase, into a little crate.
2023-07-12 22:10:08 -07:00
f4e9ef6af9 seperate the hyperlegible font-face to a template
this lets me make the base html code cleaner and it lets me keep using a
seperate file for font-face stuff so the style.css is cleaner. this is
implemented by using the askama template engine with the same syntax
that was used in the style tag in base.html, but i render the template
to text instead of directly to a rocket responder and i hash it with the
sha2 crate. this hashing should only run once, at startup, so it
shouldn't be much of a performance hit.
2023-07-12 18:41:39 -07:00
0e3ffc0991 move crates out to a folder
this should make the code cleaner if we need to add more crates as it
can get messy if we keep stacking crates in the root directory
2023-07-12 17:36:39 -07:00
a23a71f39f remove the md5 dependency from Cargo.toml
this never was used so it shouldn't need to be here.
2023-07-11 17:21:47 -07:00
50d92e998a Merge pull request 'add an index page and add name functions to the API and cache busting' (#7) from index-page into main
Reviewed-on: #7
2023-07-11 11:08:07 +00:00
70bb0691d3 implement a CachedResponse Responder struct
this adds a Cache-Control header to existing responses so they can be
cached in the browser. cache busting means this cache can be immutable
as if the file changes, the filename changes, so the browser will get
new files.
2023-07-11 02:37:31 -07:00
53193d84b8 add cache busting filenames and split off assets
i abstraced the file handling out to a global static struct called
"Files" that is only written to once, in main inside a OnceLock. i also
split out asset handling into its own module folder called assets which
has all the asset handling code.

i also have a new crate called "proc_macros" which provides a attribute macro
that adds the base_template field to each struct i decorate with it
using the syn and quote crates.
2023-07-11 01:04:53 -07:00
1654821763 bump version number to 0.2.0 2023-07-09 23:31:53 -07:00
4e17ef7dff update stylesheet and clean up asset code
the stylesheet got a new update from my websites stylesheet with the
bigger font sizes and i split the hyperlegible font face css into its
own file and made the asset code cleaner.
2023-07-09 22:09:07 -07:00
74f3cd1cb4 fix a bug with the next_name function
looks like i used the previous_name logic for element of the vector i
used which is wrong.
2023-07-07 23:03:29 -07:00
6e9bbe1d60 add cors and previous and next name functions 2023-07-05 02:10:31 -07:00
ec9d5cd874 Merge pull request 'hot reloading support' (#6) from hot-reloading into main
Reviewed-on: #6
2023-07-04 14:26:42 +00:00
79e88cb2f4 add a WIP index page 2023-07-03 23:59:56 -07:00
33f0b6a5e9 don't panic on parsing error with running watcher
this means the watcher doesn't stop working if someone makes an edit to
names.json that results in a parser error. it will just print out the
error and keep the old configuration. if you restart the program and the
file still has an error, the program won't start.
2023-07-03 22:41:32 -07:00
93bd3540e8 use async mutex
looks like the best way to do the state thing after all is global so i
should use async mutexes so stuff doesn't block.
2023-07-03 22:14:10 -07:00
a672135793 add cursed hot reloading support
im sorry if you have to look at the sites.rs file.
2023-07-03 16:23:14 -07:00
ac93e8e0eb Merge pull request 'make printing less complicated and refactor cli' (#5) from improvements into main
Reviewed-on: #5
2023-07-03 23:20:53 +00:00
d6a763a90b change spelling of seperator to separator
looks like i spelt that wrong..
2023-07-03 16:19:45 -07:00
82e8f68862 make printing less complicated and refactor cli
i made printing less complicated by making printing both the name and
the url with the seperator the default option and using both those flags
at the same time should do the same thing as just printing without any
flags.

i also refactored commands into their own module folder with each
command getting their own file module.
2023-07-02 19:46:19 -07:00
df86523df2 Merge pull request 'make stuff more portable and improve the cli' (#4) from portability into main
Reviewed-on: #4
2023-07-02 10:39:29 +00:00
0c5fce59ca add an error if you try to add a url that exists. 2023-07-01 22:14:33 -07:00
a08502cc73 add a filter argument to the print command
this lets you put a url in and the print command will filter it to that.
2023-07-01 22:10:58 -07:00
f37034b8d8 add json string support to the cli's print command
this let's you print a json string.
2023-07-01 20:49:59 -07:00
e93b201d77 move command group printing logic into function
this makes the print function a bit cleaner.
2023-07-01 20:39:56 -07:00
7f36560e25 add a seperator character
this means you can print both the url and the name at the same time
with a seperator character for easy parsing.
2023-07-01 20:34:28 -07:00
b58b0cd78f meowy_webring::main now uses the shared crate
this has abstractions for getting the names.json file and reading them
and parsing them. i also moved the cli logger initialization code into
its own module.
2023-07-01 19:49:48 -07:00
8206cc6105 make the cli more portable, and add logging
the cli now uses a new module in the shared crate, called directories
which is a module that has functions for directory stuff, mainly, it
uses the directories crate to have a portable way to have directories
for the application like data directories and config directories.

i also added logging to the shared and cli crates, so you can see debug
stuff with the RUST_LOG environment variable.
2023-07-01 18:27:03 -07:00
16c5c771bb Merge pull request 'json file support and a cli' (#3) from json into main
Reviewed-on: #3
2023-07-01 18:35:52 +00:00
3fa6a24a5d Merge pull request 'fix json bugs and add a cli' (#2) from cli into json
Reviewed-on: #2

Looks good, cat
2023-07-01 18:24:54 +00:00
9411e4a097 add a remove command and error handling to the cli 2023-06-30 23:12:55 -07:00
c729d2115b add a add command to the cli
this command can add sites to the names.json file
2023-06-30 22:11:44 -07:00
c481999c55 add a work in progress cli and fix bugs
i'm making a cli that lets you add stuff to the names.json file and read
data from it and i moved stuff that can be shared between them like the
Site struct to a shared crate thats in workspace, like the cli crate. i
also switched to using typed json parsing which works well.
2023-06-30 21:43:18 -07:00
Mossfet
1667e14d64 Initial json parsing 2023-06-30 17:47:25 +01:00
Mossfet
c2fe292b2d Prepped code for names being defined at runtime in rocket() 2023-06-30 11:47:46 +01:00
7dc2d5350b disable the http/2 feature in rocket
nginx doesn't support proxying http/2 and this app is almost certainly
going to be put behind a reverse proxy. this also reduces the binary
size.
2023-06-29 22:34:15 -07:00
2227c870ff Merge pull request 'use the askama compile time template engine' (#1) from askama into main
Reviewed-on: #1
2023-06-30 04:30:28 +00:00
5cbbacec23 use the askama compile time template engine
this has the exact same syntax as tera (jinja style) but its compile
time which is very useful for having a portable binary that doesn't
require any files to run like a templates folder or public folder.
2023-06-29 21:24:53 -07:00
9c3002a8d0 add a not found template and reorgainze the code
this commit does quite a bit as it adds a not found html template and it
reorganized the code entirely by splitting stuff into modules.
2023-06-29 19:45:41 -07:00
8581bc5f65 remove an option to disable overflowing
looks like webrings should just overflow.
2023-06-29 18:05:34 -07:00
515e5ed199 add a json api.
i added a json api called /name which lets you get the previous and next
site name. i also modified the internal url functions to return a None
value if overflow is turned off and next or previous is nothing.
2023-06-28 16:13:48 -07:00
ebe7b5cbc5 add a basic implementation of the webring
you put your sites url into the url query and it should redirect you to
the next or previous site and it will overflow if you're the last or
first site in the array.
2023-06-28 15:08:23 -07:00
Mossfet
3e054fc7f0 Weeee 2023-06-28 21:32:25 +01:00
8391b63ce8 Initial commit 2023-06-28 20:10:48 +00:00