Closed prikhi closed 4 years ago
About the article tags, I think it would be nice to have something like this in Rib's API:
data OpenGraph =
...
_openGraph_type :: OGType
data OGType =
OGType_Article Article
..
data Article
= Article
{ _article_section :: Maybe Text
, _article_modifiedTime :: Maybe UTCTime
...
}
PRs for rib welcome!
Author is creator of first message in a topic?
Perhaps we should change the type of author to Maybe Text
in rib.
_messageAvatarUrl as URI.URI instead of Text?
Yes. Let's call mkURI
in Zulip.Client
's mkArchive
function.
generated og:image tag has html-escaped ampersands - is that OK?
Example?
About the article tags, [...]
Should I make the times UTCTime
or POSIXTime
? The time fields in Zulip.Client
are POSIX.
I'll shoot a PR to Rib soon.
generated og:image tag has html-escaped ampersands - is that OK?
Example?
From http://localhost:8000/haskell/gnu-terry-pratchett.html:
<meta property="og:image" content="https://secure.gravatar.com/avatar/51413c298d0dbf10639e259f8af5b837?d=identicon&version=1">
The link works when you paste it into your location bar, but I'm not sure if crawlers will encode the &
in the &
again and end up with something like &amp;
.
Also I noticed the README says that it'll serve the site at http://localhost:8080/ but that no longer seems to be the case. I've been getting by with:
cd site/
python -m http.server
which serves it at http://localhost:8000/
_messageAvatarUrl
is now a URI
. I had to add orphan aeson instances for the URI
type, figured the Zulip.Internal
module was a good place for them. I could also quickly publish a modern-uri-aeson
package to get those out of the code if you like.
@prikhi You shouldn't need to be using a third-party http server. Rib has its own http server.
[Rib] Serving at http://localhost:8080
).I'm running what's in the README:
nix-shell --run 'ghcid -T :main --restart=config'
Which spits this out:
Loading cabal repl --ghc-options=-fno-break-on-exception --ghc-options=-fno-break-on-error --ghc-options=-v1 --ghc-options=-ferror-spans --ghc-options=-j ...
Build profile: -w ghc-8.8.2 -O1
In order, the following will be built (use -v for more details):
- zulip-archive-0.1.0.0 (exe:zulip-archive) (first run)
Preprocessing executable 'zulip-archive' for zulip-archive-0.1.0.0..
GHCi, version 8.8.2: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/prikhi/.ghc/ghci.conf
<no location info>: warning: [-Wmissing-home-modules]
These modules are needed for compilation but not listed in your .cabal file's other-modules:
Config Web.Slug Web.UniqSlug Zulip.Client Zulip.Internal
[1 of 6] Compiling Config ( src/Config.hs, interpreted )
[2 of 6] Compiling Web.Slug ( src/Web/Slug.hs, interpreted )
[3 of 6] Compiling Web.UniqSlug ( src/Web/UniqSlug.hs, interpreted )
[4 of 6] Compiling Zulip.Internal ( src/Zulip/Internal.hs, interpreted )
[5 of 6] Compiling Zulip.Client ( src/Zulip/Client.hs, interpreted )
[6 of 6] Compiling Main ( src/Main.hs, interpreted )
Ok, six modules loaded.
]0;All good, at 11:57:23 (running test) - zulip-archive
All good (6 modules, at 11:57:23)
Running test...
[Rib] Generating static/ (full=False)
Loading messages.json
("lastMsgId", 190573731)
↓ Url Https ("messages" :| ["v1","api","funprog.zulipchat.com"])
("Fetched ", 1, True, True)
("Writing ", 2970, " <> ", 1)
("hasNew", False)
↓ Url Https ("streams" :| ["v1","api","funprog.zulipchat.com"])
↓ Url Https ("users" :| ["v1","api","funprog.zulipchat.com"])
↓ Url Https ("server_settings" :| ["v1","api","funprog.zulipchat.com"])
Waiting for 15 min
Interrupted.
[?25h
@prikhi That bug should now be fixed. README now says: nix-shell --run 'ghcid -T ":main serve" --restart=config'
(note that serve
command).
@prikhi I'd go with UTCTime
. And the orphan instances are fine. I don't know what to make of the html-escaping in the image URL; but we can revisit it separately if ever turns out to be a problem.
Bumped the Rib revision, adjusted code to my Rib commit, rebased against master, & squashed commits.
Also the updated build command in the README works great :+1:
Refactor the OpenGraph Protocol metatag rendering to use the new Rib.Extra.OpenGraph module.
Change the type of the Message type's _messageAvatarUrl field from Text to a URI. This requires adding orphan instance of the Aeson type classes to Zulip.Internal.
Bump the Rib version to the latest master commit.
Closes #20