Skip to content

Commit 7846f18

Browse files
committed
fix: using hash route for diff page so server can not read data
1 parent c8bbf19 commit 7846f18

File tree

2 files changed

+7
-38
lines changed

2 files changed

+7
-38
lines changed

pages/diff/_diff.vue renamed to pages/diff.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@
8787

8888
<script>
8989
import pako from 'pako'
90-
import { undoUrlSafeBase64 } from '../../helpers/utils'
90+
import { undoUrlSafeBase64 } from '../helpers/utils'
9191
export default {
9292
layout: 'main',
9393
mounted() {
94-
const { diff: _diff } = this.$route.params
94+
const _diff = this.$route.hash
9595
const gunzip = pako.ungzip(Buffer.from(undoUrlSafeBase64(_diff), 'base64'))
9696
const diff = JSON.parse(Buffer.from(gunzip).toString('utf8'))
9797
this.lhsDiff = diff

pages/index.vue

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,15 @@
1212
<div class="flex flex-wrap w-full h-full gap-4">
1313
<textarea
1414
id="lhs"
15-
class="
16-
flex-1
17-
h-full
18-
max-h-full
19-
bg-transparent
20-
rounded-md
21-
resize-none
22-
form-textarea
23-
"
15+
class="flex-1 h-full max-h-full bg-transparent rounded-md resize-none form-textarea"
2416
></textarea>
2517
<textarea
2618
id="rhs"
27-
class="
28-
flex-1
29-
h-full
30-
max-h-full
31-
bg-transparent
32-
rounded-md
33-
resize-none
34-
form-textarea
35-
"
19+
class="flex-1 h-full max-h-full bg-transparent rounded-md resize-none form-textarea"
3620
></textarea>
3721
<div class="self-end flex-grow-0 w-full text-center">
3822
<button
39-
class="
40-
inline-flex
41-
items-center
42-
justify-center
43-
w-48
44-
px-4
45-
py-2
46-
transition-transform
47-
transform
48-
bg-blue-600
49-
rounded-md
50-
shadow-lg
51-
outline-none
52-
text-gray-50
53-
focus:ring-4
54-
active:scale-y-75
55-
"
23+
class="inline-flex items-center justify-center w-48 px-4 py-2 transition-transform transform bg-blue-600 rounded-md shadow-lg outline-none text-gray-50 focus:ring-4 active:scale-y-75"
5624
>
5725
Compare
5826
</button>
@@ -113,7 +81,8 @@ export default Vue.extend({
11381
'base64'
11482
)
11583
this.$router.push({
116-
path: `/diff/${doUrlSafeBase64(gzip)}`,
84+
path: '/diff',
85+
hash: `#${doUrlSafeBase64(gzip)}`,
11786
})
11887
},
11988
},

0 commit comments

Comments
 (0)