Skip to content

Commit

Permalink
Merge pull request #16938 from schlawg/always-be-hashing
Browse files Browse the repository at this point in the history
always be hashing
  • Loading branch information
ornicar authored Feb 10, 2025
2 parents 47624e2 + f83f02f commit 59c7274
Show file tree
Hide file tree
Showing 62 changed files with 956 additions and 723 deletions.
2 changes: 0 additions & 2 deletions app/views/base/embed.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ object embed:
(ctx.bg == "system").option(page.ui.systemThemeScript(ctx.nonce.some)),
page.ui.pieceSprite(ctx.pieceSet.name),
cssTag("common.theme.embed"),
link(rel := "stylesheet", href := assetUrl("css/theme/font-face.css")),
cssKeys.map(cssTag),
page.ui.scriptsPreload(modules.flatMap(_.map(_.key)))
),
Expand Down Expand Up @@ -67,7 +66,6 @@ object embed:
(ctx.bg == "system").option(page.ui.systemThemeScript(ctx.nonce.some)),
page.ui.pieceSprite(ctx.pieceSet.name),
cssTag("common.theme.embed"),
link(rel := "stylesheet", href := assetUrl("css/theme/font-face.css")),
cssKeys.map(cssTag),
page.ui.sitePreload(
List[I18nModule.Selector](_.site, _.timeago) ++ i18nModules,
Expand Down
11 changes: 6 additions & 5 deletions app/views/base/page.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ object page:
raw(s"""<meta name="theme-color" content="${ctx.pref.themeColor}">""")

private def boardPreload(using ctx: Context) = frag(
preload(staticAssetUrl(s"images/board/${ctx.pref.currentTheme.file}"), "image", crossorigin = false),
preload(assetUrl(s"images/board/${ctx.pref.currentTheme.file}"), "image", crossorigin = false),
ctx.pref.is3d.option(
preload(
staticAssetUrl(s"images/staunton/board/${ctx.pref.currentTheme3d.file}"),
assetUrl(s"images/staunton/board/${ctx.pref.currentTheme3d.file}"),
"image",
crossorigin = false
)
Expand Down Expand Up @@ -61,7 +61,6 @@ object page:
else s"${ctx.me.so(_.username.value + " ")} $prodTitle"
,
cssTag("common.theme.all"),
link(rel := "stylesheet", href := assetUrl("css/theme/font-face.css")),
cssTag("site"),
pref.is3d.option(cssTag("common.board-3d")),
ctx.data.inquiry.isDefined.option(cssTag("mod.inquiry")),
Expand All @@ -81,8 +80,10 @@ object page:
noTranslate,
p.openGraph.map(lila.web.ui.openGraph),
p.atomLinkTag | dailyNewsAtom,
(pref.bg == lila.pref.Pref.Bg.TRANSPARENT).option(pref.bgImgOrDefault).map { img =>
val url = escapeHtmlRaw(img).replace("&amp;", "&")
(pref.bg == lila.pref.Pref.Bg.TRANSPARENT).option(pref.bgImgOrDefault).map { loc =>
val url =
if loc.startsWith("/assets/") then assetUrl(loc.drop(8))
else escapeHtmlRaw(loc).replace("&amp;", "&")
raw(s"""<style id="bg-data">html.transp::before{background-image:url("$url");}</style>""")
},
fontPreload,
Expand Down
2 changes: 1 addition & 1 deletion modules/web/src/main/AssetManifest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ final class AssetManifest(environment: Environment, net: NetConfig, ws: Standalo
.map { (k, asset) =>
val hash = (asset \ "hash").as[String]
val name = k.substring(k.lastIndexOf('/') + 1)
val extPos = name.indexOf('.')
val extPos = name.lastIndexOf('.')
val hashedName =
if extPos < 0 then s"${name}.$hash"
else s"${name.slice(0, extPos)}.$hash${name.substring(extPos)}"
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
},
"dependencies": {
"@types/lichess": "workspace:*",
"@types/web": "^0.0.194",
"@typescript-eslint/eslint-plugin": "^8.20.0",
"@typescript-eslint/parser": "^8.20.0",
"@types/web": "^0.0.201",
"@typescript-eslint/eslint-plugin": "^8.23.0",
"@typescript-eslint/parser": "^8.23.0",
"ab": "github:lichess-org/ab-stub",
"chessground": "^9.1.1",
"chessops": "^0.14.2",
"eslint": "^9.18.0",
"lint-staged": "^15.3.0",
"eslint": "^9.20.0",
"lint-staged": "^15.4.3",
"onchange": "^7.1.0",
"prettier": "^3.4.2",
"snabbdom": "3.5.1",
Expand Down
Loading

0 comments on commit 59c7274

Please sign in to comment.