fix: resolve all hosting and url addresses

This commit is contained in:
Ananth Venkatesh 2025-03-01 02:38:24 -05:00
parent f1e0aa5ec0
commit 86adaa86a2
Signed by: ananthv
GPG key ID: 4BB578E748CFE4FF
3 changed files with 35 additions and 24 deletions

View file

@ -119,11 +119,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1740560979,
"narHash": "sha256-Vr3Qi346M+8CjedtbyUevIGDZW8LcA1fTG0ugPY/Hic=",
"lastModified": 1740695751,
"narHash": "sha256-D+R+kFxy1KsheiIzkkx/6L63wEHBYX21OIwlFV8JvDs=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5135c59491985879812717f4c9fea69604e7f26f",
"rev": "6313551cd05425cd5b3e63fe47dbc324eabb15e4",
"type": "github"
},
"original": {

View file

@ -82,6 +82,7 @@ type alias Model =
, h : Int
, last : String
, url : Url.Url
, path : String
, key : Nav.Key
, mesh : Maybe Object3d
, textures : Maybe (Material.Textured Obj.Decode.ObjCoordinates)
@ -95,19 +96,20 @@ type alias Model =
type alias Flags =
( Int, Int )
( Int, Int, String )
init : Flags -> Url.Url -> Nav.Key -> ( Model, Cmd Msg )
init flags url key =
let
( width, height ) =
( width, height, path ) =
flags
in
( { w = width
, h = height
, last = ""
, url = url
, path = path
, key = key
, mesh = Nothing
, textures = Nothing
@ -459,12 +461,12 @@ id =
Html.Attributes.id >> Element.htmlAttribute
getPaths : String -> List String
getPaths base =
getPaths : String -> String -> List String
getPaths path base =
let
root : String
root =
"/" ++ base
path ++ base
in
List.map ((++) root) [ "", "/", "/index.html" ]
@ -484,13 +486,18 @@ itemize multikeys entry =
[]
sitemap : Dict String (Model -> List (Html Msg))
sitemap =
sitemap : Model -> Dict String (Model -> List (Html Msg))
sitemap model =
let
getter : String -> List String
getter =
getPaths model.path
in
Dict.fromList
(itemize ([ "/", "/index.html" ] ++ getPaths "src" ++ getPaths "index" ++ getPaths "home") pageHome
++ itemize (getPaths "entries") pageEntries
++ itemize (getPaths "about") pageAbout
++ itemize (getPaths "colophon") colophon
(itemize ([ "/", "/index.html", model.path ] ++ getter "src" ++ getter "index" ++ getter "home") pageHome
++ itemize (getter "entries") pageEntries
++ itemize (getter "about") pageAbout
++ itemize (getter "colophon") colophon
)
@ -499,7 +506,7 @@ loadUrl model =
let
req : Maybe (Model -> List (Html Msg))
req =
Dict.get model.url.path sitemap
Dict.get model.url.path (sitemap model)
in
case req of
Just builder ->
@ -533,9 +540,9 @@ menu model =
, Font.size 18
]
(row [ spacing 20 ]
[ inlineLinkInt "Entries" "/entries"
, inlineLinkInt "Access" "/about"
, inlineLinkInt "Colophon" "/colophon"
[ inlineLinkInt "Entries" (model.path ++ "entries")
, inlineLinkInt "Access" (model.path ++ "about")
, inlineLinkInt "Colophon" (model.path ++ "colophon")
]
)
@ -782,7 +789,7 @@ pageAbout model =
, column [ spacing 15 ]
[ row
[ spacing 15 ]
[ linkBtnInt " Back" "/"
[ linkBtnInt " Back" model.path
, btn "Directions" (Scroll "one")
]
, row [ spacing 15 ]
@ -809,7 +816,7 @@ pageAbout model =
, column
(page model ++ [ id "one" ])
[ image (fullImage model)
{ src = "../assets/img/map.png"
{ src = model.path ++ "../assets/img/map.png"
, description = "mit campus map with pin at macgregor house"
}
, column (pageText model)
@ -960,7 +967,7 @@ pageEntries model =
[ row
[ spacing 15
]
[ linkBtnInt " Back" "/"
[ linkBtnInt " Back" model.path
, btn "Explore " (ScrollToEntry "J")
]
]
@ -1341,7 +1348,7 @@ notFound model =
[ text "You were likely redirected here by a link to a page on the old website, the last known archive of which can be found "
, inlineLink "here" "https://web.archive.org/web/20170529064230/http://macgregor.mit.edu/"
, text ". Unless you want to conduct research on ancient MIT traditions, you can probably find what you're looking for on the new "
, inlineLinkInt "main page" "/src"
, inlineLinkInt "main page" (model.path ++ "/src")
, text ". If you believe this page really is missing, "
, inlineLink "contact the webmaster" "mailto:ananthv@mit.edu"
, text "."
@ -1415,7 +1422,7 @@ colophon model =
]
[ text "Colophon."
, row [ spacing 15 ]
[ linkBtnInt " Back" "/"
[ linkBtnInt " Back" model.path
, linkBtn "Source" "https://forgejo.mit.edu/ananthv/macgregor"
, btn "Literature" (Scroll "one")
]

View file

@ -16,7 +16,11 @@
<script>
var app = Elm.Main.init({
node: document.getElementById("app"),
flags: [window.innerWidth, window.innerHeight],
flags: [
window.innerWidth,
window.innerHeight,
window.location.pathname,
],
});
app.ports.copyToClipboard.subscribe((tuple) => {