Skip to content

Commit 067ac87

Browse files
authored
make JS invariant (#2241)
* make JS invariant * new version
1 parent 6631200 commit 067ac87

File tree

4 files changed

+47
-8
lines changed

4 files changed

+47
-8
lines changed

config/secure-headers.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,15 +517,19 @@
517517
const hashMatch = document.location.hash.replace("#", "").split("/");
518518
const albumID = hashMatch[0] ?? '';
519519
const photoID = hashMatch[1] ?? '';
520+
const elem = document.getElementById('redirectData');
521+
const gallery = elem.dataset.gallery;
522+
const base = elem.dataset.redirect;
523+
520524
if (photoID !== '') {
521-
window.location = '{{ $gallery }}/' + albumID + '/' + photoID;
525+
window.location = gallery + '/' + albumID + '/' + photoID;
522526
} else if (albumID !== '') {
523-
window.location = '{{ $gallery }}/' + albumID;
527+
window.location = gallery + '/' + albumID;
524528
} else {
525-
window.location = '{{ $base }}';
529+
window.location = base;
526530
}
527531
*/
528-
'9zK0oWYjhW+ACIwFsQ6ksB1HCJ5EoUi+lRyrSt465A4=',
532+
'okzzdI+OgeNYCr3oJXDZ/rPI5WwGyiU5V/RwOQrv5zE=',
529533

530534
/*
531535
document.addEventListener("DOMContentLoaded", function(event) {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Support\Facades\DB;
5+
6+
return new class() extends Migration {
7+
/**
8+
* Run the migrations.
9+
*
10+
* @return void
11+
*/
12+
public function up(): void
13+
{
14+
DB::table('configs')->where('key', 'version')->update(['value' => '050102']);
15+
}
16+
17+
/**
18+
* Reverse the migrations.
19+
*
20+
* @return void
21+
*/
22+
public function down(): void
23+
{
24+
DB::table('configs')->where('key', 'version')->update(['value' => '050101']);
25+
}
26+
};
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1+
<div
2+
id="redirectData"
3+
data-gallery="{{ $gallery }}"
4+
data-redirect="{{ $base }}"
5+
></div>
16
<script>
27
// Dirty work around.
38
const hashMatch = document.location.hash.replace("#", "").split("/");
49
const albumID = hashMatch[0] ?? '';
510
const photoID = hashMatch[1] ?? '';
11+
const elem = document.getElementById('redirectData');
12+
const gallery = elem.dataset.gallery;
13+
const base = elem.dataset.redirect;
14+
615
if (photoID !== '') {
7-
window.location = '{{ $gallery }}/' + albumID + '/' + photoID;
16+
window.location = gallery + '/' + albumID + '/' + photoID;
817
} else if (albumID !== '') {
9-
window.location = '{{ $gallery }}/' + albumID;
18+
window.location = gallery + '/' + albumID;
1019
} else {
11-
window.location = '{{ $base }}';
20+
window.location = base;
1221
}
1322
</script>

version.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.1.1
1+
5.1.2

0 commit comments

Comments
 (0)