solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

feat:encode sfn > functionId & extractedFilename

Open thinke5 opened this issue 8 months ago • 10 comments

PR Checklist

Please check if your PR fulfills the following requirements:

  • [x] Addresses an existing open issue: fixes #1859
  • [ ] Tests for the changes have been added (for bug fixes / features)

What is the current behavior?

image

What is the new behavior?

image

Other information

The encoded characters are guaranteed to be ASCII characters, and the path before src is removed to improve security and reduce string size

Currently encoded as base64, the size increases by 25%, but I don't know if there is a better way

thinke5 avatar Mar 27 '25 07:03 thinke5

⚠️ No Changeset found

Latest commit: b640817896d7821920bf09eb08c6fa0b0aa1a9d1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Mar 27 '25 07:03 changeset-bot[bot]

Deploy Preview for solid-start-landing-page ready!

Name Link
Latest commit b640817896d7821920bf09eb08c6fa0b0aa1a9d1
Latest deploy log https://app.netlify.com/sites/solid-start-landing-page/deploys/67ec9cd71d4b760008d7a51b
Deploy Preview https://deploy-preview-1872--solid-start-landing-page.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Mar 27 '25 07:03 netlify[bot]

Could probably use a simple hash such as a xxhash32(filename), but otherwise this is fine.

lxsmnsyc avatar Mar 27 '25 09:03 lxsmnsyc

Could probably use a simple hash such as a xxhash32(filename), but otherwise this is fine.

~~Hash functions are usually irreversible.~~

~~if use encryption algorithms (such as AES) or compression algorithms (such as lz-string), need to decode it every time call handleServerFunction, which may cause high CPU consumption and network latency.~~

~~So I choose to use base64 for now.~~

thinke5 avatar Mar 27 '25 12:03 thinke5

I have come up with a solution that can use hash algorithm,` HandleServerFunction does not require decoding. I need some time to verify

thinke5 avatar Mar 27 '25 15:03 thinke5

I don't think we need to decode anything. We just use the IDs for lookup and verification anyways.

lxsmnsyc avatar Mar 27 '25 16:03 lxsmnsyc

Now,only Encode extractedFilename with encodeURIComponent.

In addition, I found that extractedFilename is not used in this process, 🤔 maybe it can be removed?

thinke5 avatar Mar 28 '25 07:03 thinke5

@lxsmnsyc any other comments on this pr?

brenelz avatar Jul 12 '25 01:07 brenelz

@brenelz this PR is fine, but we'll need a solution that outputs a shorter output like xxhash32

lxsmnsyc avatar Jul 12 '25 01:07 lxsmnsyc

@thinke5 did you want to look at this following Alexis' comment?

brenelz avatar Sep 02 '25 22:09 brenelz