-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: add callouts and examples for keygen in other languages #1035
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Warning Rate limit exceeded@juliusmarminge has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 8 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe changes primarily enhance the documentation for file uploads to UploadThing. A new section detailing the generation of valid file keys has been added, including code snippets in multiple programming languages. The documentation structure has been improved with tabs for easier navigation. Additionally, updates were made to the Changes
Possibly related PRs
Suggested labels
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
📦 Bundle size comparison
|
I think ruby and Java are probably the two other big ones. I have had a surprising number of people ask about dotnet too, but I don't think there is really demand there |
god do i have to install java on my system... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (3)
docs/src/mdx/rehype.js (1)
40-41
: LGTM! Consider adding Ruby support.
The addition of Go and PHP syntax highlighting support is correctly implemented. Since Ruby was mentioned as a potential addition in the PR objectives, consider adding "ruby" to the langs
array if Ruby examples will be included in the documentation.
docs/src/app/(docs)/uploading-files/page.mdx (2)
Line range hint 140-154
: Consider adding error handling for base64 encoding.
The JavaScript implementation should handle potential errors during base64 encoding.
function generateKey(appId: string, fileSeed: string) {
const alphabet = shuffle(defaultOptions.alphabet, appId);
const encodedAppId = new SQIds({ alphabet, minLength: 12 }).encode([
Math.abs(Hash.string(appId)),
]);
- const encodedFileSeed = encodeBase64(fileSeed);
+ try {
+ const encodedFileSeed = encodeBase64(fileSeed);
+ return `${encodedAppId}${encodedFileSeed}`;
+ } catch (error) {
+ throw new Error(`Failed to encode file seed: ${error.message}`);
+ }
- return `${encodedAppId}${encodedFileSeed}`;
}
191-199
: Add type hints for better code clarity in Python.
The Python implementation would benefit from complete type hints.
-def generate_key(file_seed: str, app_id: str) -> str:
+def generate_key(file_seed: str, app_id: str) -> str:
alphabet = shuffle(constants.DEFAULT_ALPHABET, app_id)
- encoded_app_id = Sqids(alphabet, min_length=12).encode(
+ encoded_app_id: str = Sqids(alphabet=alphabet, min_length=12).encode(
[abs(hash_string(app_id))]
)
return encoded_app_id + file_seed
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- docs/src/app/(docs)/uploading-files/page.mdx (3 hunks)
- docs/src/mdx/rehype.js (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/src/app/(docs)/uploading-files/page.mdx
[style] ~106-~106: Try using a more formal synonym here to elevate your writing.
Context: ...se to generate valid file keys. We also plan on making this process easier in the future. <No...
(PLAN_ON_INTEND)
[duplication] ~116-~116: Possible typo: you repeated a word
Context: ...xtra latency to your uploads. <Tabs tabs={["JavaScript", "Python", "PHP", "Go"]}...
(ENGLISH_WORD_REPEAT_RULE)
🔇 Additional comments (2)
docs/src/app/(docs)/uploading-files/page.mdx (2)
116-116
: LGTM! Tabs implementation is correct.
The tabs implementation properly follows MDX conventions and provides a good user experience for switching between language examples.
🧰 Tools
🪛 LanguageTool
[duplication] ~116-~116: Possible typo: you repeated a word
Context: ...xtra latency to your uploads. <Tabs tabs={["JavaScript", "Python", "PHP", "Go"]}...
(ENGLISH_WORD_REPEAT_RULE)
105-114
: Consider rephrasing for clarity and formality.
Consider revising "we also plan on making" to "we intend to make" for a more formal tone.
Let's verify the referenced endpoint exists:
🧰 Tools
🪛 LanguageTool
[style] ~106-~106: Try using a more formal synonym here to elevate your writing.
Context: ...se to generate valid file keys. We also plan on making this process easier in the future. <No...
(PLAN_ON_INTEND)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (1)
docs/src/app/(docs)/uploading-files/page.mdx (1)
Line range hint 140-155
: Add missing base64 encoding implementation.
The code mentions using base64 encoding for the file seed but doesn't show the implementation. Consider adding the encoding function for completeness:
function encodeBase64(str: string): string {
return Buffer.from(str).toString('base64url')
}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- docs/src/app/(docs)/uploading-files/page.mdx (3 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/src/app/(docs)/uploading-files/page.mdx
[style] ~106-~106: Try using a more formal synonym here to elevate your writing.
Context: ...se to generate valid file keys. We also plan on making this process easier in the future. <No...
(PLAN_ON_INTEND)
[duplication] ~116-~116: Possible typo: you repeated a word
Context: ...xtra latency to your uploads. <Tabs tabs={["JavaScript", "Python", "PHP", "Go"]}...
(ENGLISH_WORD_REPEAT_RULE)
🔇 Additional comments (1)
docs/src/app/(docs)/uploading-files/page.mdx (1)
105-114
: LGTM! Clear and informative introduction.
The introduction effectively sets up the context for the code examples and provides a helpful note about the REST endpoint fallback option.
🧰 Tools
🪛 LanguageTool
[style] ~106-~106: Try using a more formal synonym here to elevate your writing.
Context: ...se to generate valid file keys. We also plan on making this process easier in the future. <No...
(PLAN_ON_INTEND)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
TODO
/v7/prepareUpload
endpoint https://github.com/pingdotgg/uploadthing-infra/pull/584Summary by CodeRabbit
Documentation
/v7/prepareUpload
REST endpoint.Bug Fixes
generateKey
to improve clarity in the documentation.Chores