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": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1740560979, "lastModified": 1740695751,
"narHash": "sha256-Vr3Qi346M+8CjedtbyUevIGDZW8LcA1fTG0ugPY/Hic=", "narHash": "sha256-D+R+kFxy1KsheiIzkkx/6L63wEHBYX21OIwlFV8JvDs=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5135c59491985879812717f4c9fea69604e7f26f", "rev": "6313551cd05425cd5b3e63fe47dbc324eabb15e4",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -82,6 +82,7 @@ type alias Model =
, h : Int , h : Int
, last : String , last : String
, url : Url.Url , url : Url.Url
, path : String
, key : Nav.Key , key : Nav.Key
, mesh : Maybe Object3d , mesh : Maybe Object3d
, textures : Maybe (Material.Textured Obj.Decode.ObjCoordinates) , textures : Maybe (Material.Textured Obj.Decode.ObjCoordinates)
@ -95,19 +96,20 @@ type alias Model =
type alias Flags = type alias Flags =
( Int, Int ) ( Int, Int, String )
init : Flags -> Url.Url -> Nav.Key -> ( Model, Cmd Msg ) init : Flags -> Url.Url -> Nav.Key -> ( Model, Cmd Msg )
init flags url key = init flags url key =
let let
( width, height ) = ( width, height, path ) =
flags flags
in in
( { w = width ( { w = width
, h = height , h = height
, last = "" , last = ""
, url = url , url = url
, path = path
, key = key , key = key
, mesh = Nothing , mesh = Nothing
, textures = Nothing , textures = Nothing
@ -459,12 +461,12 @@ id =
Html.Attributes.id >> Element.htmlAttribute Html.Attributes.id >> Element.htmlAttribute
getPaths : String -> List String getPaths : String -> String -> List String
getPaths base = getPaths path base =
let let
root : String root : String
root = root =
"/" ++ base path ++ base
in in
List.map ((++) root) [ "", "/", "/index.html" ] List.map ((++) root) [ "", "/", "/index.html" ]
@ -484,13 +486,18 @@ itemize multikeys entry =
[] []
sitemap : Dict String (Model -> List (Html Msg)) sitemap : Model -> Dict String (Model -> List (Html Msg))
sitemap = sitemap model =
let
getter : String -> List String
getter =
getPaths model.path
in
Dict.fromList Dict.fromList
(itemize ([ "/", "/index.html" ] ++ getPaths "src" ++ getPaths "index" ++ getPaths "home") pageHome (itemize ([ "/", "/index.html", model.path ] ++ getter "src" ++ getter "index" ++ getter "home") pageHome
++ itemize (getPaths "entries") pageEntries ++ itemize (getter "entries") pageEntries
++ itemize (getPaths "about") pageAbout ++ itemize (getter "about") pageAbout
++ itemize (getPaths "colophon") colophon ++ itemize (getter "colophon") colophon
) )
@ -499,7 +506,7 @@ loadUrl model =
let let
req : Maybe (Model -> List (Html Msg)) req : Maybe (Model -> List (Html Msg))
req = req =
Dict.get model.url.path sitemap Dict.get model.url.path (sitemap model)
in in
case req of case req of
Just builder -> Just builder ->
@ -533,9 +540,9 @@ menu model =
, Font.size 18 , Font.size 18
] ]
(row [ spacing 20 ] (row [ spacing 20 ]
[ inlineLinkInt "Entries" "/entries" [ inlineLinkInt "Entries" (model.path ++ "entries")
, inlineLinkInt "Access" "/about" , inlineLinkInt "Access" (model.path ++ "about")
, inlineLinkInt "Colophon" "/colophon" , inlineLinkInt "Colophon" (model.path ++ "colophon")
] ]
) )
@ -782,7 +789,7 @@ pageAbout model =
, column [ spacing 15 ] , column [ spacing 15 ]
[ row [ row
[ spacing 15 ] [ spacing 15 ]
[ linkBtnInt " Back" "/" [ linkBtnInt " Back" model.path
, btn "Directions" (Scroll "one") , btn "Directions" (Scroll "one")
] ]
, row [ spacing 15 ] , row [ spacing 15 ]
@ -809,7 +816,7 @@ pageAbout model =
, column , column
(page model ++ [ id "one" ]) (page model ++ [ id "one" ])
[ image (fullImage model) [ image (fullImage model)
{ src = "../assets/img/map.png" { src = model.path ++ "../assets/img/map.png"
, description = "mit campus map with pin at macgregor house" , description = "mit campus map with pin at macgregor house"
} }
, column (pageText model) , column (pageText model)
@ -960,7 +967,7 @@ pageEntries model =
[ row [ row
[ spacing 15 [ spacing 15
] ]
[ linkBtnInt " Back" "/" [ linkBtnInt " Back" model.path
, btn "Explore " (ScrollToEntry "J") , 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 " [ 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/" , 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 " , 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, " , text ". If you believe this page really is missing, "
, inlineLink "contact the webmaster" "mailto:ananthv@mit.edu" , inlineLink "contact the webmaster" "mailto:ananthv@mit.edu"
, text "." , text "."
@ -1415,7 +1422,7 @@ colophon model =
] ]
[ text "Colophon." [ text "Colophon."
, row [ spacing 15 ] , row [ spacing 15 ]
[ linkBtnInt " Back" "/" [ linkBtnInt " Back" model.path
, linkBtn "Source" "https://forgejo.mit.edu/ananthv/macgregor" , linkBtn "Source" "https://forgejo.mit.edu/ananthv/macgregor"
, btn "Literature" (Scroll "one") , btn "Literature" (Scroll "one")
] ]

View file

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