Skip to content

Commit

Permalink
always compress URL
Browse files Browse the repository at this point in the history
  • Loading branch information
joneugster committed Sep 2, 2024
1 parent c814278 commit 92dc673
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,25 +314,25 @@ function App() {
// LZ padds the string with trailing `=`, which mess up the argument parsing
// and aren't needed for LZ encoding, so we remove them.
const compressed = LZString.compressToBase64(code).replace(/=*$/, '')
// Note: probably temporary; might be worth to always compress as with whitespace encoding
// it needs very little for the compressed version to be shorter
const encodedCode = fixedEncodeURIComponent(code)
console.debug(`[Lean4web]: code length: ${encodedCode.length}, compressed: ${compressed.length}`)
if (compressed.length < encodedCode.length) {
// // Note: probably temporary; might be worth to always compress as with whitespace encoding
// // it needs very little for the compressed version to be shorter
// const encodedCode = fixedEncodeURIComponent(code)
// console.debug(`[Lean4web]: code length: ${encodedCode.length}, compressed: ${compressed.length}`)
// if (compressed.length < encodedCode.length) {
args = {
project: _project,
url: null,
code: null,
codez: compressed
}
} else {
args = {
project: _project,
url: null,
code: encodedCode,
codez: null
}
}
// } else {
// args = {
// project: _project,
// url: null,
// code: encodedCode,
// codez: null
// }
// }
} else {
args = {
project: _project,
Expand Down
2 changes: 1 addition & 1 deletion client/src/Popups/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const SettingsPopup: FC<{
<p>
<Switch id="compress" onChange={() => {modifyPreferences("compress", !preferences.compress)}}
checked={preferences.compress} />
<label htmlFor="compress">Compress code in URL (if shorter)</label>
<label htmlFor="compress">Compress code in URL</label>
</p>

<h2>Save</h2>
Expand Down

0 comments on commit 92dc673

Please sign in to comment.