-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33c0d11
commit b9a4869
Showing
8 changed files
with
126 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
module Lib.Database where | ||
|
||
import Control.Monad | ||
import Data.Maybe | ||
import Data.Text qualified as T | ||
import Database.MongoDB | ||
import Network.URI | ||
|
||
getDbInfo :: String -> (String, Username, Password) | ||
getDbInfo uri = fromJust $ do | ||
parsed <- parseURI uri | ||
|
||
guard $ uriScheme parsed == "mongodb+srv:" | ||
|
||
uriAuth <- uriAuthority parsed | ||
|
||
let (uname, pw) = T.breakOn ":" . T.pack $ uriUserInfo uriAuth | ||
|
||
return (uriRegName uriAuth, uname, T.tail . T.init $ pw) | ||
|
||
getPipe :: ReplicaSet -> Username -> Password -> IO Pipe | ||
getPipe rs uname passwd = do | ||
pipe <- primary rs | ||
_ <- access pipe master admin (auth uname passwd) | ||
return pipe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
import "htmx.org"; | ||
import htmx from "htmx.org"; | ||
import Alpine from "alpinejs"; | ||
import morph from "@alpinejs/morph"; | ||
|
||
window.Alpine = Alpine; | ||
Alpine.plugin(morph); | ||
|
||
Alpine.start(); | ||
|
||
htmx.on("htmx:afterSettle", () => { | ||
document.querySelectorAll("time").forEach((el) => { | ||
const d = new Date(el.dateTime); | ||
|
||
el.innerText = d.toLocaleString(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters