Compare commits

..
61 Commits
Author SHA1 Message Date
whoswhip 4b01d801eb chore: update version to 3.0.2 in package-lock.json 2026-01-31 11:45:44 -05:00
whoswhip a76213b397 chore: bump version to 3.0.2 2026-01-31 11:45:25 -05:00
whoswhip e4cf98af09 feat: add conventional-changelog and conventional-changelog-angular dependencies 2026-01-31 11:44:48 -05:00
whoswhip 8b3f397837 style(frontend): format via prettier 2026-01-31 11:41:50 -05:00
whoswhip a6ffa982a4 fix: improve error handling and update user display name modal 2026-01-31 11:41:22 -05:00
whoswhip 005cb5de23 feat: add inputMaxLength property to Modal component for better input control 2026-01-31 11:41:15 -05:00
whoswhip 05cd024110 chore: disable admins_require_2fa in dev 2026-01-31 11:23:48 -05:00
whoswhip 270360a32f fix: add IValidateableObject interface to required DTO's ensuring model validation 2026-01-31 11:23:23 -05:00
whoswhip 79ca6ffa80 refactor: implement renderPaste to call per syntax rendering functions 2026-01-30 17:15:32 -05:00
whoswhip 15f0be5a2f fix: update version to 3.0.1 in package-lock.json 2026-01-30 17:14:41 -05:00
whoswhip c52ad8ba9b fix: enable AllowMissingPrunePackageData in project configuration 2026-01-30 17:14:29 -05:00
whoswhip 5375e1caa6 feat: enhance PasteService with caching and cache invalidation methods 2026-01-28 09:13:32 -05:00
whoswhip 81f85defb0 style: format via prettier 2026-01-28 08:53:56 -05:00
whoswhip 2cc2379e10 refactor: make unnecessary asynchronous methods synchronous 2026-01-28 08:53:32 -05:00
whoswhip adcaaadd7e refactor: change ValidSyntaxLanguages from string array to HashSet for improved performance 2026-01-28 08:47:49 -05:00
whoswhip 1af3c095c4 refactor: use inline cache with tag on stats 2026-01-28 08:47:06 -05:00
whoswhip ca210c5ea3 feat: add output caching and stats endpoint to track pastes and users
i plan to implement caching for all other endpoints but output cache doesn't have what i need right now
2026-01-28 07:53:58 -05:00
whoswhip 854e50fe78 feat: include createdAt in user responses 2026-01-28 05:17:03 -05:00
whoswhip 500f457f97 feat: user createdAt property 2026-01-28 05:16:37 -05:00
whoswhip 8aa1543296 feat: include paste createdAt in responses 2026-01-28 04:40:59 -05:00
whoswhip 9d0cc54db4 feat: createdAt paste property 2026-01-28 04:40:38 -05:00
whoswhip 3101f83e3f chore: index syntax, views, and size on pastes 2026-01-28 04:31:28 -05:00
whoswhip d2486b9f6e fix: adjust input margin for title field in paste creation 2026-01-28 00:45:05 -05:00
whoswhip 5b6498746b chore: change-log script 2026-01-27 03:53:24 -05:00
whoswhip 15b9109ee5 chore: generate changelog via conventional-changelog 2026-01-27 03:51:18 -05:00
whoswhip 44e6b3e423 chore: bump version 2026-01-27 03:49:58 -05:00
whoswhip a7481b5852 fix: adjust tooltip formatting for decrypted size display 2026-01-26 23:15:25 -05:00
whoswhip ca79582693 Merge branch 'SharpbinV3' of https://github.com/whoswhip/Sharpbin into SharpbinV3 2026-01-26 22:41:25 -05:00
whoswhip 16f5bff317 fix: update resize function call to use previewMode ensuring resize when switched to code 2026-01-26 22:17:23 -05:00
whoswhip b0a774afbb chore(deps-dev): bump svelte from 5.46.1 to 5.48.3 in /SharpbinV3.Client
Merge pull request #2 from whoswhip/dependabot/npm_and_yarn/SharpbinV3.Client/svelte-5.48.3
2026-01-26 19:46:52 -05:00
dependabot[bot] 78c94e9195 chore(deps-dev): bump svelte from 5.46.1 to 5.48.3 in /SharpbinV3.Client
Bumps [svelte](https://github.com/sveltejs/svelte/tree/HEAD/packages/svelte) from 5.46.1 to 5.48.3.
- [Release notes](https://github.com/sveltejs/svelte/releases)
- [Changelog](https://github.com/sveltejs/svelte/blob/main/packages/svelte/CHANGELOG.md)
- [Commits](https://github.com/sveltejs/svelte/commits/svelte@5.48.3/packages/svelte)

---
updated-dependencies:
- dependency-name: svelte
  dependency-version: 5.48.3
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-27 00:45:25 +00:00
whoswhip 4d0352b4e4 refactor: size(decrypted) -> Decrypted Size 2026-01-26 19:42:02 -05:00
whoswhip c940fc5207 feat: enhance CSV rendering with header support and improved styling 2026-01-26 19:41:33 -05:00
whoswhip 7082fc4534 feat: include decrypted size in paste size tooltip 2026-01-26 19:21:20 -05:00
whoswhip bfad18bb05 feat: add CSV rendering functionality with PapaParse 2026-01-26 19:09:38 -05:00
whoswhip 147e43cd8a feat: add CSV to syntax lists 2026-01-26 19:09:32 -05:00
whoswhip 95316f5a84 feat: add papaparse and its type definitions 2026-01-26 19:08:59 -05:00
whoswhip 091c6d895e feat: style dropdown scrollbar 2026-01-26 03:42:36 -05:00
whoswhip 43f9a25915 feat: add tailwind-scrollbar npm package 2026-01-26 03:41:27 -05:00
whoswhip 6e59fbe627 style: format via prettier 2026-01-26 03:33:48 -05:00
whoswhip ec62e3be75 fix: enhance password validation and add show/hide functionality 2026-01-25 23:08:06 -05:00
whoswhip 3681f586dc fix: allow flexible display on cf turnstile 2026-01-25 23:07:56 -05:00
whoswhip a06021f0cd fix: update Open Graph description to use syntax name from consts 2026-01-25 23:07:28 -05:00
whoswhip 5ecb6a9714 chore: only show reports if length > 0 2026-01-25 22:31:35 -05:00
whoswhip 75010d3034 fix: render all turnstiles as flexible and interaction-only 2026-01-25 22:29:03 -05:00
whoswhip 71fb5b1616 fix: resolve lint issue svelte/no-at-html-tags
the html has already been sanitized by dompurify
2026-01-25 10:14:47 -05:00
whoswhip 6c8cdccbbf fix: update visibility icons in Paste component 2026-01-25 10:14:06 -05:00
whoswhip 4db986715c fix: enhance Paste component layout and user information display 2026-01-25 10:13:56 -05:00
whoswhip c9aa0d9a16 fix: include author data in recent paste data 2026-01-25 09:41:59 -05:00
whoswhip 51449abe6e fix: resize markdown preview as well 2026-01-25 08:38:32 -05:00
whoswhip 9c49c21e62 fix: update Turnstile configuration and improve layout for verification 2026-01-25 05:24:28 -05:00
whoswhip c1784f626a style(docs): format via prettier 2026-01-25 05:11:08 -05:00
whoswhip c95b2fe0c3 docs: reorganize project structure section in README 2026-01-25 05:10:49 -05:00
whoswhip 9d0bf7e5af docs: update description to include link for pastebin reference 2026-01-25 05:10:41 -05:00
whoswhip 3f4201b12c docs: add live instance link to README 2026-01-25 05:10:32 -05:00
whoswhip 33dce1ef17 style: format via prettier 2026-01-25 04:25:23 -05:00
whoswhip 2d01e726a9 fix: adjust dropdown max height dynamically and improve search input positioning 2026-01-25 04:24:54 -05:00
whoswhip a6b98a97f8 refactor: move expiration options into consts.ts 2026-01-25 04:24:39 -05:00
whoswhip 01efa399cf fix: adjust height properties for paste creation info 2026-01-24 23:11:50 -05:00
whoswhip 590f0c3da9 fix: disable pointer events on menu icons 2026-01-24 06:26:37 -05:00
whoswhip 1937307ae7 feat: close hamburger menu when clicked outside 2026-01-24 06:26:29 -05:00
39 changed files with 2672 additions and 399 deletions
+176
View File
@@ -0,0 +1,176 @@
## [3.0.1](https://github.com/whoswhip/Sharpbin/compare/v3.0.0...v3.0.1) (2026-01-27)
### Bug Fixes
* adjust dropdown max height dynamically and improve search input positioning ([2d01e72](https://github.com/whoswhip/Sharpbin/commit/2d01e726a97b99a35017df9f477fa1304213bc9e))
* adjust height properties for paste creation info ([01efa39](https://github.com/whoswhip/Sharpbin/commit/01efa399cf7d7aa1d38af1bc29017a8873f97dca))
* adjust tooltip formatting for decrypted size display ([a7481b5](https://github.com/whoswhip/Sharpbin/commit/a7481b5852532d42697e723f8f49cfa126ce8212))
* allow flexible display on cf turnstile ([3681f58](https://github.com/whoswhip/Sharpbin/commit/3681f586dc0a01fcfd197db3961386d4ac7fe371))
* disable pointer events on menu icons ([590f0c3](https://github.com/whoswhip/Sharpbin/commit/590f0c3da9c4bd6f9db43a5866dddfb9a2859326))
* enhance password validation and add show/hide functionality ([ec62e3b](https://github.com/whoswhip/Sharpbin/commit/ec62e3be7556f083ef8380dd4eece4f5e5b4f148))
* enhance Paste component layout and user information display ([4db9867](https://github.com/whoswhip/Sharpbin/commit/4db986715cfd36d300677b7e527ff8e2de827791))
* include author data in recent paste data ([c9aa0d9](https://github.com/whoswhip/Sharpbin/commit/c9aa0d9a16f9135be7be4b100c6c0966f3285e6a))
* render all turnstiles as flexible and interaction-only ([75010d3](https://github.com/whoswhip/Sharpbin/commit/75010d303424a45d9435571b45e4d0d29ade23a9))
* resize markdown preview as well ([51449ab](https://github.com/whoswhip/Sharpbin/commit/51449abe6e894d289374ec7ffcef21ff3d1e71c9))
* resolve lint issue svelte/no-at-html-tags ([71fb5b1](https://github.com/whoswhip/Sharpbin/commit/71fb5b16160aa986ca577c25373dcc382ff96ba3))
* update Open Graph description to use syntax name from consts ([a06021f](https://github.com/whoswhip/Sharpbin/commit/a06021f0cd67162446d9393a854ddc4f7f3a74b0))
* update resize function call to use `previewMode` ensuring resize when switched to code ([16f5bff](https://github.com/whoswhip/Sharpbin/commit/16f5bff317a6620e3a7e5a0fd99ac6b56599dd8e))
* update Turnstile configuration and improve layout for verification ([9c49c21](https://github.com/whoswhip/Sharpbin/commit/9c49c21e62118d277670677e51a685150194a2b6))
* update visibility icons in Paste component ([6c8cdcc](https://github.com/whoswhip/Sharpbin/commit/6c8cdccbbfd3becdd5fae4674909c788f00edab7))
### Features
* add CSV rendering functionality with PapaParse ([bfad18b](https://github.com/whoswhip/Sharpbin/commit/bfad18bb0551ddc2eb03f934ecedd2b7b89ddbf2))
* add CSV to syntax lists ([147e43c](https://github.com/whoswhip/Sharpbin/commit/147e43cd8ab32da538e6ff76a68cdb7441e469e2))
* add papaparse and its type definitions ([95316f5](https://github.com/whoswhip/Sharpbin/commit/95316f5a846c03a5e2b014717c26bea9005f933d))
* add tailwind-scrollbar npm package ([43f9a25](https://github.com/whoswhip/Sharpbin/commit/43f9a25915ac32076636ab86781aa7efb5240b41))
* close hamburger menu when clicked outside ([1937307](https://github.com/whoswhip/Sharpbin/commit/1937307ae728f0d77c9ee572adf1ba688648e0aa))
* enhance CSV rendering with header support and improved styling ([c940fc5](https://github.com/whoswhip/Sharpbin/commit/c940fc5207a80563a620b37c9aeebce395c659e9))
* include decrypted size in paste size tooltip ([7082fc4](https://github.com/whoswhip/Sharpbin/commit/7082fc45346824f14d6f8fe85743f73eca6a35c1))
* style dropdown scrollbar ([091c6d8](https://github.com/whoswhip/Sharpbin/commit/091c6d895e638fc13b68207e3ae765664dfc80b6))
# [3.0.0](https://github.com/whoswhip/Sharpbin/compare/050f0bc935937b8b80500a59bc6ac5513fd7af93...v3.0.0) (2026-01-24)
### Bug Fixes
* add ASPNETCORE_URLS environment variable for backend service in docker-compose.yml ([c4f606e](https://github.com/whoswhip/Sharpbin/commit/c4f606ecf265678495b616a11c0fab1aa4ca9331))
* add cursor pointer to the submit button for better UX ([f5de211](https://github.com/whoswhip/Sharpbin/commit/f5de211611c8142c0825286c0f514b1edc161d51))
* add validation for display name length in user creation and update requests ([9bb620a](https://github.com/whoswhip/Sharpbin/commit/9bb620a4a31473385af6ffd32d2b7d7c5affd415))
* adjust password hint display logic in registration form ([361cf76](https://github.com/whoswhip/Sharpbin/commit/361cf76f46598c1d797c745e44f2de5d960682bc))
* center-align text in login and registration links in navbar ([4dafde7](https://github.com/whoswhip/Sharpbin/commit/4dafde739aaf04d4a7b0e08ee15415518bcf2e7b))
* change to non-reactive statements ([55bee20](https://github.com/whoswhip/Sharpbin/commit/55bee20e5de3d4c155f2eaa0f7999110a86aa535))
* correct conditional logic for user role checks in component rendering ([7298982](https://github.com/whoswhip/Sharpbin/commit/729898296b4e09fa8cada5feb524f1d3774a2d7c))
* correct environment variable key for Turnstile Site Key in docker-compose ([2773813](https://github.com/whoswhip/Sharpbin/commit/2773813c263d59a20ceabd02ebabd763a3832ebc))
* correct property name for TOTP enabled flag in parseTotpEnabled function ([9e56c4e](https://github.com/whoswhip/Sharpbin/commit/9e56c4eee1d97227b821d643640d2d1db593aba7))
* correct syntax selection logic for file drag and drop handling ([62b5dce](https://github.com/whoswhip/Sharpbin/commit/62b5dcef00e6230ec8674d3de65617216e760e51))
* display 2FA status only for the account owner ([4de6a6a](https://github.com/whoswhip/Sharpbin/commit/4de6a6a1186e97a7063d5e55008f9acc5043b912))
* dont disabled login button when registrations are disabled ([bbfa9ff](https://github.com/whoswhip/Sharpbin/commit/bbfa9ffc560a87bcc8441fddc6d78496819a9144))
* enhance paste size validation logic ([f467a2a](https://github.com/whoswhip/Sharpbin/commit/f467a2a89966e6025d7ac0a60eb89c99956e4d28))
* enhance textarea styling and display content metrics ([fabef95](https://github.com/whoswhip/Sharpbin/commit/fabef95159e469abcf6316362f18de25aab0a0c6))
* enhance tooltip functionality and update last login display ([d3c2efd](https://github.com/whoswhip/Sharpbin/commit/d3c2efd2108026b5e49f1a199c6f2afdeb0a06a0))
* ensure JSDOM is only loaded in server-side environments ([7789ab6](https://github.com/whoswhip/Sharpbin/commit/7789ab6cb2822ca338186573c010047a3c5b0f48))
* improve error handling and display for login failures ([ce66fe1](https://github.com/whoswhip/Sharpbin/commit/ce66fe13e8718b8abbf67adca9fa1775c932401f))
* improve error handling and response messages in EditPaste method ([284c5e9](https://github.com/whoswhip/Sharpbin/commit/284c5e927e1ef796026ca1b1a078adadc1986721))
* improve error handling for registration response ([d514e45](https://github.com/whoswhip/Sharpbin/commit/d514e456bf364b1dbdbd7e67938ca609c2362468))
* improve error handling in paste fetching and add error page ([5e4afaf](https://github.com/whoswhip/Sharpbin/commit/5e4afafac0e57a24316761c555892fee5dc8394a))
* improve error logging for view count increment failure ([8b84a2d](https://github.com/whoswhip/Sharpbin/commit/8b84a2d8a3dbcfa0909a9ba7ac79531244c268f2))
* improve formatBytes function and display byte size in textarea ([2a9a4b9](https://github.com/whoswhip/Sharpbin/commit/2a9a4b9eefaef513df5437a9d548e1941583fc1e))
* include url queries in resolve ([7857c32](https://github.com/whoswhip/Sharpbin/commit/7857c327eac1a2371552bedc1571650bffb29c0d))
* increase max height ([7650fd7](https://github.com/whoswhip/Sharpbin/commit/7650fd786dbcffb9cba6aba9c073d9ec5e19c737))
* inline is expired calculation ([2b60ee8](https://github.com/whoswhip/Sharpbin/commit/2b60ee86369731ebc98deaf007c725a544382b2a))
* lint issues resolved ([21b6f95](https://github.com/whoswhip/Sharpbin/commit/21b6f95edc1ff34a3ee66f32083b4f99d9bbf2ac))
* load turnstile script in layout and explicitly render ([2c24af5](https://github.com/whoswhip/Sharpbin/commit/2c24af5ac98dd4959e353571d3186fb98b459bf4))
* null user/paste fk in reports on delete ([f8a1490](https://github.com/whoswhip/Sharpbin/commit/f8a149058295ebc56fc43cecf03b76792fc62529))
* prevent moderators from modifiying higher roles(admin) ([3711885](https://github.com/whoswhip/Sharpbin/commit/3711885a38e18ddf6e478e17c671c4c7774c0d3e))
* properly set limiter ([6f99036](https://github.com/whoswhip/Sharpbin/commit/6f990364a59b0a9801a6dbd715c70c2f29e63e9c))
* refresh token ([19f439a](https://github.com/whoswhip/Sharpbin/commit/19f439a4052d16a3bddba36dc15822906ca92e11))
* remove dependency condition for backend service health check in docker-compose.yml ([095df2f](https://github.com/whoswhip/Sharpbin/commit/095df2f3f3aff1eccf4f023ca1a77bc11d66bbea))
* remove quotes from DATA_PROTECTION_KEY_PATH in docker-compose ([f96396b](https://github.com/whoswhip/Sharpbin/commit/f96396b586f5f0b5da66227c08767be348f5cbab))
* remove quotes from default connection string in docker-compose ([d5565f9](https://github.com/whoswhip/Sharpbin/commit/d5565f9a68bf38035d994002812c3411427f563e))
* remove unused nuget package ([4bd6a18](https://github.com/whoswhip/Sharpbin/commit/4bd6a18e31970f4568f0d405454c30b56e06c895))
* reset Turnstile on login and registration error handling ([5a630d2](https://github.com/whoswhip/Sharpbin/commit/5a630d2a715acc851add8f82b19dba111d98c2bd))
* reset turnstile on login error handling ([1da88db](https://github.com/whoswhip/Sharpbin/commit/1da88dba4ed500baf6dc57b6eeb02b115c0fd000))
* resolve lint issues ([1f4fda1](https://github.com/whoswhip/Sharpbin/commit/1f4fda1a16f92cebae716642482d959ad300c5a7))
* ssr request to user; navbar positioning ([bffc4e2](https://github.com/whoswhip/Sharpbin/commit/bffc4e2bf41fe1a3dd93f3042be0e796b6f986d2))
* **style:** update Navbar styling for improved layout and consistency ([6c3caaf](https://github.com/whoswhip/Sharpbin/commit/6c3caaf2ecaa6dc9e616d7f5a7f65ee1a15c091c))
* **styling:** add table styling for markdown elements ([825d384](https://github.com/whoswhip/Sharpbin/commit/825d384db4c906f373ea92ae3e4b46efd741e862))
* **styling:** adjust margin and padding for first child in markdown elements ([8f5499a](https://github.com/whoswhip/Sharpbin/commit/8f5499ae05f69c131447fef6188680d448ed895e))
* **styling:** enforce max width on recent pastes titles ([8accfa2](https://github.com/whoswhip/Sharpbin/commit/8accfa2dc525f528337e2cbd79ab6a6a2c2b748f))
* token refreshing using wrong object path ([e45785e](https://github.com/whoswhip/Sharpbin/commit/e45785e1b8bb64a0834cf420db4866307146132d))
* update API fetch calls to use dynamic apiUrl ([6072f7f](https://github.com/whoswhip/Sharpbin/commit/6072f7f674bc3def903815de35536ed933cff7fd))
* update API routes for fetching raw paste content and deleting pastes ([48543c7](https://github.com/whoswhip/Sharpbin/commit/48543c7ff03b1ff4b3efa96de56097fb9ada2f02))
* update database connection string configuration in Program.cs and docker-compose.yml ([011b523](https://github.com/whoswhip/Sharpbin/commit/011b523fd321e0834c73790b2553adee37a022f6))
* update docker-compose to reflect correct backend directory structure ([113ad49](https://github.com/whoswhip/Sharpbin/commit/113ad499d9806a7a237f6afdb9a6bf02ebc238aa))
* update environment variables in docker-compose for backend and frontend services ([5e8d7be](https://github.com/whoswhip/Sharpbin/commit/5e8d7be86423247e63a350d440bc52cf3428d312))
* update Navbar and layout server to improve structure and data handling ([a912d04](https://github.com/whoswhip/Sharpbin/commit/a912d0463b1e8517f055f596c2cb033b88db6b9b))
* update paste view count display in metadata ([f9b63ed](https://github.com/whoswhip/Sharpbin/commit/f9b63edf776e2715b09de2d408aab4ba85ccd50f))
* update profile link to direct to user page instead of dashboard ([ff52498](https://github.com/whoswhip/Sharpbin/commit/ff52498cf99a74936d47d73369c7fdd7b771f0df))
* update SQLite connection string retrieval in Program.cs ([6178888](https://github.com/whoswhip/Sharpbin/commit/6178888246871f38ab8373bacbb2a61fba6d4046))
* update TOTP API request payload to use 'code' instead of 'totpcode' ([6bcc62a](https://github.com/whoswhip/Sharpbin/commit/6bcc62a7e7b77c1129c16d9a8c979e003b6481e5))
* update version number to 3.0.0 and remove beta check from footer ([8252d58](https://github.com/whoswhip/Sharpbin/commit/8252d58f47d503a0c40f95bde9ee277341e801b9))
* use $app/state ([b44f0bc](https://github.com/whoswhip/Sharpbin/commit/b44f0bce0ab5f7fcedf9c206362a31947215eef9))
* use margin-bottom instead of margin-top for elements ([bd7d115](https://github.com/whoswhip/Sharpbin/commit/bd7d1154eaf57e310a82cb43c09baf15c499a489))
### Features
* /raw/{id} endpoint ([ca87b1a](https://github.com/whoswhip/Sharpbin/commit/ca87b1a5f220a6f3b8857cf00602abf867c9a7d9))
* account deletion; auto incremental uids; display name renaming UI + account deletion UI; enhanced username validation ([fe54ff1](https://github.com/whoswhip/Sharpbin/commit/fe54ff15ce7122373643eece9981eb05a1d7c7d0))
* add application version definition to Vite config ([eca6867](https://github.com/whoswhip/Sharpbin/commit/eca6867fcab5c1ba4d1d327c76f18fd21290abd6))
* add delete functionality for pastes with authorization check ([3015f97](https://github.com/whoswhip/Sharpbin/commit/3015f97ff977fbfd9b23a11aad016ac7408be752))
* add Dockerfile and docker-compose for backend and frontend services ([31142e0](https://github.com/whoswhip/Sharpbin/commit/31142e0cf96d2ff868fadf1ecac192a07ebc5c2d))
* add editedAt field to Paste interface and enhance paste editing functionality ([86b74a1](https://github.com/whoswhip/Sharpbin/commit/86b74a140a546651d301079b71531468d0b1d52d))
* add Footer component to layout for improved user navigation ([e093550](https://github.com/whoswhip/Sharpbin/commit/e0935505ea01c286cb802337461b1ebbb4eb6f2d))
* add health check endpoint returning status ok ([dfdce51](https://github.com/whoswhip/Sharpbin/commit/dfdce51c6e648b601880a16644d7790b41550129))
* add health checks for backend and frontend services in docker-compose.yml ([08c4be4](https://github.com/whoswhip/Sharpbin/commit/08c4be4f7eb8e985114d1f87a8bd69a7bad0a9ee))
* add health checks for backend and frontend services in docker-compose.yml ([57dad56](https://github.com/whoswhip/Sharpbin/commit/57dad564a6df35ea488fab40fa9798511036d4ac))
* add health checks for database connectivity ([cab1b17](https://github.com/whoswhip/Sharpbin/commit/cab1b170c1218c47c5c4f366425731c3fdb5d67a))
* add isBinaryData utility function and integrate it into paste handling; add drag and drop functionality when creating a paste ([bf0eac9](https://github.com/whoswhip/Sharpbin/commit/bf0eac9ed8aa00cf4d82236cf8257f87bc6b8588))
* add markdown parsing and rendering support ([406381f](https://github.com/whoswhip/Sharpbin/commit/406381fbfe724249b41477f64ef42116882a671d))
* add Pagination interface and integrate it into User type ([a9e1e82](https://github.com/whoswhip/Sharpbin/commit/a9e1e823591c01be4dc960bf5427131480dfa413))
* add pagination to user retrieval endpoints; enhance BuildUserResponse to include pagination details ([93df14e](https://github.com/whoswhip/Sharpbin/commit/93df14e59ce876c877d34d28a9f0a0cf3d53eb28))
* add PasteCleanUpService as a hosted service ([f578b58](https://github.com/whoswhip/Sharpbin/commit/f578b58780930d253837d4e1c795f46c6b27b9df))
* add PasteSettings environment variables for internal API key and HMAC secret ([a6fa65c](https://github.com/whoswhip/Sharpbin/commit/a6fa65c3bd67fbb1133737d738626c345304f503))
* add recent pastes page with data fetching and display logic ([8a6ab29](https://github.com/whoswhip/Sharpbin/commit/8a6ab29f52ddd6e05c211569323d0d4d48b4938b))
* add registration status check and disable form elements when registration is disabled ([b1d2d3f](https://github.com/whoswhip/Sharpbin/commit/b1d2d3f5bba5e7f0bab38448fc25baa8a4551317))
* add variant support for dropdown component styling ([1950dc4](https://github.com/whoswhip/Sharpbin/commit/1950dc47ae8c5ca721851999afb2ce32b7c5c4cb))
* admins can change user's roles ([99feb27](https://github.com/whoswhip/Sharpbin/commit/99feb2795a17b43724985cbf1722088fde0ac281))
* auth, compression, jwt, paste wip, roles, ratelimiting ([6ec1a7f](https://github.com/whoswhip/Sharpbin/commit/6ec1a7fa7b3254e6ab09aaed8943534b79dac9cd))
* auto detect syntax from file extension on drag and drop; syntax from extension function ([9e05600](https://github.com/whoswhip/Sharpbin/commit/9e056009e3858d9a56bd71638cd32db3ce122a60))
* bypass user confirmation when loading external assets in markdown for trusted domains ([35d891b](https://github.com/whoswhip/Sharpbin/commit/35d891bed7bd7fb2415a14e74f45eb5b7d4e3453))
* create Paste component for displaying paste details ([753d28f](https://github.com/whoswhip/Sharpbin/commit/753d28f720c9f7f6a3b7d787ca19a8149d592ee7))
* declare application version constant in app.d.ts ([72206e9](https://github.com/whoswhip/Sharpbin/commit/72206e9ba214b602cafd2836d880ac06debb69de))
* enable registration toggle and update Navbar to reflect registration status ([159fcc2](https://github.com/whoswhip/Sharpbin/commit/159fcc2a890480cfad0cc19dd153c84aa1af88d0))
* enhance AuthService to support admin role assignment for the first user ([c934c85](https://github.com/whoswhip/Sharpbin/commit/c934c85b130d2c0086146110f3211f612387b8d3))
* enhance code highlighting for plaintext in syntax highlighter ([5cb30a9](https://github.com/whoswhip/Sharpbin/commit/5cb30a90a760874d54cc18e0adc63cfe6812d1c7))
* enhance decryption process with status updates and improved user feedback ([7b3af77](https://github.com/whoswhip/Sharpbin/commit/7b3af774494c31f8fcd829d20f9bb5f46242320a))
* enhance paste creation with dynamic textarea resizing and improved password handling; generate random password button in paste creation; show password in paste creation; ([5410a89](https://github.com/whoswhip/Sharpbin/commit/5410a8973a81dc6a854f1c685e3a3546de985486))
* enhance tooltip functionality and improve date formatting ([8ab66f5](https://github.com/whoswhip/Sharpbin/commit/8ab66f5f159c1c34d29c456fef9a4c626548c6aa))
* enhance tooltip functionality; prevent empty tooltips for paste titles ([7eb0204](https://github.com/whoswhip/Sharpbin/commit/7eb0204e6751df148b6520c6ccd665289e31341b))
* enhance user experience with tooltips; implement return URL handling on login and registration; add user roles; improve paste visibility checks ([5fca207](https://github.com/whoswhip/Sharpbin/commit/5fca207ad61acf0dca4c9fd13ab5a598d89ba890))
* implement decryptAes function; moved to encryption.ts ([f61f31d](https://github.com/whoswhip/Sharpbin/commit/f61f31de0e9a3c97a347d38783cddb4c0d7f83fe))
* implement mobile support for navbar ([63f55d2](https://github.com/whoswhip/Sharpbin/commit/63f55d2bdac475bd7d981d87475fa4e8cddb6b72))
* implement modal component for password input and confirmation actions ([b6e020f](https://github.com/whoswhip/Sharpbin/commit/b6e020fa6987b5ecad5ca78d24ce87e41799c177))
* implement pagination for user pastes; enhance fetchPage function and update display logic ([49b9673](https://github.com/whoswhip/Sharpbin/commit/49b9673d48d50a5ca2adea9b4c2055ae2c88f001))
* implement paste decryption ([3a54951](https://github.com/whoswhip/Sharpbin/commit/3a549511f93d7001d246c318545e6edb307e2f99))
* implement rate limiting policy for site info endpoints in Auth and Paste controllers ([3895bd9](https://github.com/whoswhip/Sharpbin/commit/3895bd968136071cc09bba686107f693f7e47dc3))
* implement registration page with Turnstile verification and loading state ([24b25c2](https://github.com/whoswhip/Sharpbin/commit/24b25c2291eea16fab16c250b5856b91f7385b74))
* implement server-side user data fetching; enhance user controller for detailed responses; update token handling to use cookies ([4151c62](https://github.com/whoswhip/Sharpbin/commit/4151c62b8cd10cdbf6a757f6e82935e8d5426a5a))
* implement Turnstile verification for enhanced security during login and registration ([848b859](https://github.com/whoswhip/Sharpbin/commit/848b8598e5fb407f284027875c1f09c396b4aa6f))
* implement user update functionality by UUID and add validation to UpdateUserRequest ([f40d4ab](https://github.com/whoswhip/Sharpbin/commit/f40d4ab68c3aabf95b8775601b1534bda9665b4b))
* improve file download naming by using syntax extension conditionally ([fed0663](https://github.com/whoswhip/Sharpbin/commit/fed06630b7383eb185b2afbdfd30d2776416bcc5))
* improve paste creation validation; add content size check and remove unnecessary logging ([dd6ce5c](https://github.com/whoswhip/Sharpbin/commit/dd6ce5c39506e9e22aeefa4db34ac8caa48a5cdd))
* improve recent page; improve SEO for pages ([3a5738b](https://github.com/whoswhip/Sharpbin/commit/3a5738b53173ddae500098ffcbf1769dada11584))
* initial commit ([050f0bc](https://github.com/whoswhip/Sharpbin/commit/050f0bc935937b8b80500a59bc6ac5513fd7af93))
* integrate hash-wasm for enhanced AES encryption and decryption ([7e1fb3a](https://github.com/whoswhip/Sharpbin/commit/7e1fb3add4f438a206638ea0c90b0a27fd108c53))
* login & registration; enhanced paste view; custom dropdown + search; navbar; global user access via store; auto token refresh; paste creation as user; /api/user/me, returns info on yourself including pastes; ([db1d870](https://github.com/whoswhip/Sharpbin/commit/db1d8704a1d0f183812fbd41ad077274c6626801))
* paste cleanup service; sveltekit frontend; paste editing; paste metadata modifying ([adad139](https://github.com/whoswhip/Sharpbin/commit/adad139081fb4d9b2ed644e8fe4cdd89ac2ef38d))
* paste compression & verification enforcement settings; enforce 2fa on admins setting; increase paste validation; anonymous uploads ([9f55aa1](https://github.com/whoswhip/Sharpbin/commit/9f55aa1b2273ee0298892dba380c71630c743289))
* paste creation, utilities, revert to gzip, grammar fixes etc ([93daa2e](https://github.com/whoswhip/Sharpbin/commit/93daa2e1a2b75cc2e93cbc7149b837e79eb9ece4))
* paste creation; paste viewing; more langs supported; jwt settings class; paste settings class; data validation on paste metadata modification ([b9b14a3](https://github.com/whoswhip/Sharpbin/commit/b9b14a3d5a553fd1e7e7294c8ba29cd8cb8218dd))
* paste views; configuration validation; hmacsha256 method; enhance paste clean up serivce; paste view clean up service; ([3048af3](https://github.com/whoswhip/Sharpbin/commit/3048af3a6dece0338e278bf6d6b2358c0f4952fc))
* preview markdown in paste creation; prevent external option in parseMarkdown ([3f27a3a](https://github.com/whoswhip/Sharpbin/commit/3f27a3a3e726e941ad6e996db53f9366506a7012))
* refactor drag and drop file handling to update syntax selection conditionally ([ca9fa81](https://github.com/whoswhip/Sharpbin/commit/ca9fa81771af49b20628c148a1ac61ad6a168bf9))
* refactor refresh token handling; update schema and logic for improved security and functionality ([ae91108](https://github.com/whoswhip/Sharpbin/commit/ae91108484ff73a6cdee16e0454acc330a221a33))
* reporting apis; better rate limiting ([14bbd9c](https://github.com/whoswhip/Sharpbin/commit/14bbd9c762f641ac738714822d19845d86bb6582))
* reports; improved+simplifed modals; extractError funcction; ([67447d5](https://github.com/whoswhip/Sharpbin/commit/67447d51aec59af200524e7f33bcee5678adc2bc))
* seo optimizations + opengraph embeds ([3bbd646](https://github.com/whoswhip/Sharpbin/commit/3bbd64631a46d510e720db3a3d5cf7ad4298702d))
* totp 2fa; httpcontext extension for jwtuser; asp.net data protection; prevent banned users from certain actions; account deletion requires 2fa if enabled; making users admins requires 2fa if enabled; httpcontext extension to get ip; enhance user store ([20ceb91](https://github.com/whoswhip/Sharpbin/commit/20ceb91db8405172d5beb9df646d3d912cea40a5))
* update API routes for paste options and recent pastes ([1f2761f](https://github.com/whoswhip/Sharpbin/commit/1f2761f463e160a0d4d865a4d6a5763fc408712b))
* update button styles for active state in paste creation ([6981836](https://github.com/whoswhip/Sharpbin/commit/698183690c1b48b6e6ebf83f62025242d746c607))
* update favicon and improve tooltip for paste size display ([1ed2178](https://github.com/whoswhip/Sharpbin/commit/1ed21789e656dfdc7a65119f4c5ec010a1669593))
* update minimum height for main sections across multiple pages for consistent layout ([c565c57](https://github.com/whoswhip/Sharpbin/commit/c565c57e20cb0eb7d6e57e17182382e2ee931190))
* view raw button; paste header follows when scrolling; scroll to top button appears after scrolling far enough ([28a0ccb](https://github.com/whoswhip/Sharpbin/commit/28a0ccbfab4461fd6fe75d25b3f7cffce063041f))
### Reverts
* Revert "chore: format via csharpier" ([6bea6c4](https://github.com/whoswhip/Sharpbin/commit/6bea6c49bef1eea4dfd72d962b4e06e20b64594f))
+10 -6
View File
@@ -1,6 +1,8 @@
# SharpbinV3 # SharpbinV3
Sharpbin is a pastebin-style website built with ASP.NET Core and SvelteKit. Sharpbin is a [pastebin](https://en.wikipedia.org/wiki/Pastebin)-style website built with ASP.NET Core and SvelteKit.
A live instance is available at [sharpbin.cc](https://sharpbin.cc).
## Features ## Features
@@ -13,20 +15,17 @@ Sharpbin is a pastebin-style website built with ASP.NET Core and SvelteKit.
- Server-side paste compression to save storage. - Server-side paste compression to save storage.
- Captcha support via Cloudflare Turnstile. - Captcha support via Cloudflare Turnstile.
## Project Structure
- **[SharpbinV3.Server](SharpbinV3.Server/README.md)**: Backend API built with C# and ASP.NET Core. Refer to its README for server-side development and configuration.
- **[SharpbinV3.Client](SharpbinV3.Client/README.md)**: Frontend application built with SvelteKit and TypeScript. Refer to its README for client-side development and setup.
## Getting Started ## Getting Started
The easiest way to run SharpbinV3 is using Docker Compose. The easiest way to run SharpbinV3 is using Docker Compose.
1. Ensure Docker and Docker Compose are installed. 1. Ensure Docker and Docker Compose are installed.
2. Clone the repository. 2. Clone the repository.
```bash ```bash
git clone https://github.com/whoswhip/Sharpbin.git git clone https://github.com/whoswhip/Sharpbin.git
``` ```
3. Run the following command in the root directory: 3. Run the following command in the root directory:
```bash ```bash
@@ -61,3 +60,8 @@ You can configure the application using environment variables. When using Docker
- `VIEW_INTERNAL_API_KEY`: Enforces views to be counted/recorded only by the frontend, if set it needs to be the same for both backend and frontend. - `VIEW_INTERNAL_API_KEY`: Enforces views to be counted/recorded only by the frontend, if set it needs to be the same for both backend and frontend.
The frontend will be accessible at http://localhost:5173. The frontend will be accessible at http://localhost:5173.
## Project Structure
- **[SharpbinV3.Server](SharpbinV3.Server/README.md)**: Backend API built with C# and ASP.NET Core. Refer to its README for server-side development and configuration.
- **[SharpbinV3.Client](SharpbinV3.Client/README.md)**: Frontend application built with SvelteKit and TypeScript. Refer to its README for client-side development and setup.
+460 -7
View File
@@ -1,12 +1,12 @@
{ {
"name": "sharpbinv3.client", "name": "sharpbinv3.client",
"version": "0.0.1", "version": "3.0.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "sharpbinv3.client", "name": "sharpbinv3.client",
"version": "0.0.1", "version": "3.0.2",
"dependencies": { "dependencies": {
"@lucide/svelte": "^0.562.0", "@lucide/svelte": "^0.562.0",
"@sveltejs/adapter-node": "^5.4.0", "@sveltejs/adapter-node": "^5.4.0",
@@ -15,6 +15,7 @@
"highlight.js": "^11.8.0", "highlight.js": "^11.8.0",
"jsdom": "^27.4.0", "jsdom": "^27.4.0",
"marked": "^17.0.1", "marked": "^17.0.1",
"papaparse": "^5.5.3",
"qrcode": "^1.5.4" "qrcode": "^1.5.4"
}, },
"devDependencies": { "devDependencies": {
@@ -26,7 +27,10 @@
"@tailwindcss/vite": "^4.1.17", "@tailwindcss/vite": "^4.1.17",
"@types/jsdom": "^27.0.0", "@types/jsdom": "^27.0.0",
"@types/node": "^22", "@types/node": "^22",
"@types/papaparse": "^5.5.2",
"@types/qrcode": "^1.5.6", "@types/qrcode": "^1.5.6",
"conventional-changelog": "^7.1.1",
"conventional-changelog-angular": "^8.1.0",
"eslint": "^9.39.1", "eslint": "^9.39.1",
"eslint-config-prettier": "^10.1.8", "eslint-config-prettier": "^10.1.8",
"eslint-plugin-svelte": "^3.13.1", "eslint-plugin-svelte": "^3.13.1",
@@ -34,8 +38,9 @@
"prettier": "^3.7.4", "prettier": "^3.7.4",
"prettier-plugin-svelte": "^3.4.0", "prettier-plugin-svelte": "^3.4.0",
"prettier-plugin-tailwindcss": "^0.7.2", "prettier-plugin-tailwindcss": "^0.7.2",
"svelte": "^5.45.6", "svelte": "^5.48.3",
"svelte-check": "^4.3.4", "svelte-check": "^4.3.4",
"tailwind-scrollbar": "^4.0.2",
"tailwindcss": "^4.1.17", "tailwindcss": "^4.1.17",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"typescript-eslint": "^8.48.1", "typescript-eslint": "^8.48.1",
@@ -80,6 +85,33 @@
"integrity": "sha512-n8GuYSrI9bF7FFZ/SjhwevlHc8xaVlb/7HmHelnc/PZXBD2ZR49NnN9sMMuDdEGPeeRQ5d0hqlSlEpgCX3Wl0Q==", "integrity": "sha512-n8GuYSrI9bF7FFZ/SjhwevlHc8xaVlb/7HmHelnc/PZXBD2ZR49NnN9sMMuDdEGPeeRQ5d0hqlSlEpgCX3Wl0Q==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@conventional-changelog/git-client": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/@conventional-changelog/git-client/-/git-client-2.5.1.tgz",
"integrity": "sha512-lAw7iA5oTPWOLjiweb7DlGEMDEvzqzLLa6aWOly2FSZ64IwLE8T458rC+o+WvI31Doz6joM7X2DoNog7mX8r4A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@simple-libs/child-process-utils": "^1.0.0",
"@simple-libs/stream-utils": "^1.1.0",
"semver": "^7.5.2"
},
"engines": {
"node": ">=18"
},
"peerDependencies": {
"conventional-commits-filter": "^5.0.0",
"conventional-commits-parser": "^6.1.0"
},
"peerDependenciesMeta": {
"conventional-commits-filter": {
"optional": true
},
"conventional-commits-parser": {
"optional": true
}
}
},
"node_modules/@csstools/color-helpers": { "node_modules/@csstools/color-helpers": {
"version": "5.1.0", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.1.0.tgz", "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.1.0.tgz",
@@ -1319,6 +1351,39 @@
"win32" "win32"
] ]
}, },
"node_modules/@simple-libs/child-process-utils": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@simple-libs/child-process-utils/-/child-process-utils-1.0.1.tgz",
"integrity": "sha512-3nWd8irxvDI6v856wpPCHZ+08iQR0oHTZfzAZmnbsLzf+Sf1odraP6uKOHDZToXq3RPRV/LbqGVlSCogm9cJjg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@simple-libs/stream-utils": "^1.1.0",
"@types/node": "^22.0.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://ko-fi.com/dangreen"
}
},
"node_modules/@simple-libs/stream-utils": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@simple-libs/stream-utils/-/stream-utils-1.1.0.tgz",
"integrity": "sha512-6rsHTjodIn/t90lv5snQjRPVtOosM7Vp0AKdrObymq45ojlgVwnpAqdc+0OBBrpEiy31zZ6/TKeIVqV1HwvnuQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "^22.0.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://ko-fi.com/dangreen"
}
},
"node_modules/@standard-schema/spec": { "node_modules/@standard-schema/spec": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",
@@ -1824,6 +1889,30 @@
"undici-types": "~6.21.0" "undici-types": "~6.21.0"
} }
}, },
"node_modules/@types/normalize-package-data": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz",
"integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/papaparse": {
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/@types/papaparse/-/papaparse-5.5.2.tgz",
"integrity": "sha512-gFnFp/JMzLHCwRf7tQHrNnfhN4eYBVYYI897CGX4MY1tzY9l2aLkVyx2IlKZ/SAqDbB3I1AOZW5gTMGGsqWliA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/prismjs": {
"version": "1.26.5",
"resolved": "https://registry.npmjs.org/@types/prismjs/-/prismjs-1.26.5.tgz",
"integrity": "sha512-AUZTa7hQ2KY5L7AmtSiqxlhWxb4ina0yd8hNbl4TWuqnv/pFP0nDMb3YrfSBf4hJVGLh2YEIBfKaBW/9UEl6IQ==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/qrcode": { "node_modules/@types/qrcode": {
"version": "1.5.6", "version": "1.5.6",
"resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.6.tgz", "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.6.tgz",
@@ -2198,6 +2287,13 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/array-ify": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz",
"integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==",
"dev": true,
"license": "MIT"
},
"node_modules/axobject-query": { "node_modules/axobject-query": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz",
@@ -2330,6 +2426,17 @@
"integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/compare-func": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz",
"integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==",
"dev": true,
"license": "MIT",
"dependencies": {
"array-ify": "^1.0.0",
"dot-prop": "^5.1.0"
}
},
"node_modules/concat-map": { "node_modules/concat-map": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -2337,6 +2444,97 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/conventional-changelog": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-7.1.1.tgz",
"integrity": "sha512-rlqa8Lgh8YzT3Akruk05DR79j5gN9NCglHtJZwpi6vxVeaoagz+84UAtKQj/sT+RsfGaZkt3cdFCjcN6yjr5sw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@conventional-changelog/git-client": "^2.5.1",
"@types/normalize-package-data": "^2.4.4",
"conventional-changelog-preset-loader": "^5.0.0",
"conventional-changelog-writer": "^8.2.0",
"conventional-commits-parser": "^6.2.0",
"fd-package-json": "^2.0.0",
"meow": "^13.0.0",
"normalize-package-data": "^7.0.0"
},
"bin": {
"conventional-changelog": "dist/cli/index.js"
},
"engines": {
"node": ">=18"
}
},
"node_modules/conventional-changelog-angular": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-8.1.0.tgz",
"integrity": "sha512-GGf2Nipn1RUCAktxuVauVr1e3r8QrLP/B0lEUsFktmGqc3ddbQkhoJZHJctVU829U1c6mTSWftrVOCHaL85Q3w==",
"dev": true,
"license": "ISC",
"dependencies": {
"compare-func": "^2.0.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/conventional-changelog-preset-loader": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-5.0.0.tgz",
"integrity": "sha512-SetDSntXLk8Jh1NOAl1Gu5uLiCNSYenB5tm0YVeZKePRIgDW9lQImromTwLa3c/Gae298tsgOM+/CYT9XAl0NA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
}
},
"node_modules/conventional-changelog-writer": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-8.2.0.tgz",
"integrity": "sha512-Y2aW4596l9AEvFJRwFGJGiQjt2sBYTjPD18DdvxX9Vpz0Z7HQ+g1Z+6iYDAm1vR3QOJrDBkRHixHK/+FhkR6Pw==",
"dev": true,
"license": "MIT",
"dependencies": {
"conventional-commits-filter": "^5.0.0",
"handlebars": "^4.7.7",
"meow": "^13.0.0",
"semver": "^7.5.2"
},
"bin": {
"conventional-changelog-writer": "dist/cli/index.js"
},
"engines": {
"node": ">=18"
}
},
"node_modules/conventional-commits-filter": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-5.0.0.tgz",
"integrity": "sha512-tQMagCOC59EVgNZcC5zl7XqO30Wki9i9J3acbUvkaosCT6JX3EeFwJD7Qqp4MCikRnzS18WXV3BLIQ66ytu6+Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
}
},
"node_modules/conventional-commits-parser": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-6.2.1.tgz",
"integrity": "sha512-20pyHgnO40rvfI0NGF/xiEoFMkXDtkF8FwHvk5BokoFoCuTQRI8vrNCNFWUOfuolKJMm1tPCHc8GgYEtr1XRNA==",
"dev": true,
"license": "MIT",
"dependencies": {
"meow": "^13.0.0"
},
"bin": {
"conventional-commits-parser": "dist/cli/index.js"
},
"engines": {
"node": ">=18"
}
},
"node_modules/cookie": { "node_modules/cookie": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz",
@@ -2503,6 +2701,19 @@
"@types/trusted-types": "^2.0.7" "@types/trusted-types": "^2.0.7"
} }
}, },
"node_modules/dot-prop": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz",
"integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"is-obj": "^2.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/emoji-regex": { "node_modules/emoji-regex": {
"version": "8.0.0", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
@@ -2835,6 +3046,16 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/fd-package-json": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/fd-package-json/-/fd-package-json-2.0.0.tgz",
"integrity": "sha512-jKmm9YtsNXN789RS/0mSzOC1NUq9mkVd65vbSSVsKdjGvYXBuE4oWe2QOEoFeRmJg+lPuZxpmrfFclNhoRMneQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"walk-up-path": "^4.0.0"
}
},
"node_modules/fdir": { "node_modules/fdir": {
"version": "6.5.0", "version": "6.5.0",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
@@ -2968,6 +3189,28 @@
"dev": true, "dev": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/handlebars": {
"version": "4.7.8",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz",
"integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"minimist": "^1.2.5",
"neo-async": "^2.6.2",
"source-map": "^0.6.1",
"wordwrap": "^1.0.0"
},
"bin": {
"handlebars": "bin/handlebars"
},
"engines": {
"node": ">=0.4.7"
},
"optionalDependencies": {
"uglify-js": "^3.1.4"
}
},
"node_modules/has-flag": { "node_modules/has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -3005,6 +3248,26 @@
"node": ">=12.0.0" "node": ">=12.0.0"
} }
}, },
"node_modules/hosted-git-info": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-8.1.0.tgz",
"integrity": "sha512-Rw/B2DNQaPBICNXEm8balFz9a6WpZrkCGpcWFpy7nCj+NyhSdqXipmfvtmWt9xGfp0wZnBxB+iVpLmQMYt47Tw==",
"dev": true,
"license": "ISC",
"dependencies": {
"lru-cache": "^10.0.1"
},
"engines": {
"node": "^18.17.0 || >=20.5.0"
}
},
"node_modules/hosted-git-info/node_modules/lru-cache": {
"version": "10.4.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
"dev": true,
"license": "ISC"
},
"node_modules/html-encoding-sniffer": { "node_modules/html-encoding-sniffer": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz",
@@ -3133,6 +3396,16 @@
"integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/is-obj": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
"integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/is-potential-custom-element-name": { "node_modules/is-potential-custom-element-name": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz",
@@ -3603,6 +3876,19 @@
"integrity": "sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==", "integrity": "sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==",
"license": "CC0-1.0" "license": "CC0-1.0"
}, },
"node_modules/meow": {
"version": "13.2.0",
"resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz",
"integrity": "sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/minimatch": { "node_modules/minimatch": {
"version": "3.1.2", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@@ -3616,6 +3902,16 @@
"node": "*" "node": "*"
} }
}, },
"node_modules/minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/mri": { "node_modules/mri": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
@@ -3665,6 +3961,28 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/neo-async": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
"dev": true,
"license": "MIT"
},
"node_modules/normalize-package-data": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-7.0.1.tgz",
"integrity": "sha512-linxNAT6M0ebEYZOx2tO6vBEFsVgnPpv+AVjk0wJHfaUIbq31Jm3T6vvZaarnOeWDh8ShnwXuaAyM7WT3RzErA==",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
"hosted-git-info": "^8.0.0",
"semver": "^7.3.5",
"validate-npm-package-license": "^3.0.4"
},
"engines": {
"node": "^18.17.0 || >=20.5.0"
}
},
"node_modules/optionator": { "node_modules/optionator": {
"version": "0.9.4", "version": "0.9.4",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
@@ -3724,6 +4042,12 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/papaparse": {
"version": "5.5.3",
"resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.5.3.tgz",
"integrity": "sha512-5QvjGxYVjxO59MGU2lHVYpRWBBtKHnlIAcSe1uNFCkkptUh63NFRj0FJQm7nR67puEruUci/ZkjmEFrjCAyP4A==",
"license": "MIT"
},
"node_modules/parent-module": { "node_modules/parent-module": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
@@ -4053,6 +4377,20 @@
} }
} }
}, },
"node_modules/prism-react-renderer": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/prism-react-renderer/-/prism-react-renderer-2.4.1.tgz",
"integrity": "sha512-ey8Ls/+Di31eqzUxC46h8MksNuGx/n0AAC8uKpwFau4RPDYLuE3EXTp8N8G2vX2N7UC/+IXeNUnlWBGGcAG+Ig==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/prismjs": "^1.26.0",
"clsx": "^2.0.0"
},
"peerDependencies": {
"react": ">=16.0.0"
}
},
"node_modules/punycode": { "node_modules/punycode": {
"version": "2.3.1", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
@@ -4079,6 +4417,17 @@
"node": ">=10.13.0" "node": ">=10.13.0"
} }
}, },
"node_modules/react": {
"version": "19.2.3",
"resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz",
"integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/readdirp": { "node_modules/readdirp": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
@@ -4274,6 +4623,16 @@
"node": ">=18" "node": ">=18"
} }
}, },
"node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/source-map-js": { "node_modules/source-map-js": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
@@ -4283,6 +4642,42 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/spdx-correct": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz",
"integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"spdx-expression-parse": "^3.0.0",
"spdx-license-ids": "^3.0.0"
}
},
"node_modules/spdx-exceptions": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz",
"integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==",
"dev": true,
"license": "CC-BY-3.0"
},
"node_modules/spdx-expression-parse": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz",
"integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"spdx-exceptions": "^2.1.0",
"spdx-license-ids": "^3.0.0"
}
},
"node_modules/spdx-license-ids": {
"version": "3.0.22",
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.22.tgz",
"integrity": "sha512-4PRT4nh1EImPbt2jASOKHX7PB7I+e4IWNLvkKFDxNhJlfjbYlleYQh285Z/3mPTHSAK/AvdMmw5BNNuYH8ShgQ==",
"dev": true,
"license": "CC0-1.0"
},
"node_modules/string-width": { "node_modules/string-width": {
"version": "4.2.3", "version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
@@ -4348,9 +4743,9 @@
} }
}, },
"node_modules/svelte": { "node_modules/svelte": {
"version": "5.46.1", "version": "5.48.3",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-5.46.1.tgz", "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.48.3.tgz",
"integrity": "sha512-ynjfCHD3nP2el70kN5Pmg37sSi0EjOm9FgHYQdC4giWG/hzO3AatzXXJJgP305uIhGQxSufJLuYWtkY8uK/8RA==", "integrity": "sha512-w7QZ398cdNherTdiQ/v3SYLLGOO4948Jgjh04PYqtTYVohmBvbmFwLmo7pp8gp4/1tceRWfSTjHgjtfpCVNJmQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@jridgewell/remapping": "^2.3.4", "@jridgewell/remapping": "^2.3.4",
@@ -4361,7 +4756,7 @@
"aria-query": "^5.3.1", "aria-query": "^5.3.1",
"axobject-query": "^4.1.0", "axobject-query": "^4.1.0",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"devalue": "^5.5.0", "devalue": "^5.6.2",
"esm-env": "^1.2.1", "esm-env": "^1.2.1",
"esrap": "^2.2.1", "esrap": "^2.2.1",
"is-reference": "^3.0.3", "is-reference": "^3.0.3",
@@ -4433,6 +4828,22 @@
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/tailwind-scrollbar": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/tailwind-scrollbar/-/tailwind-scrollbar-4.0.2.tgz",
"integrity": "sha512-wAQiIxAPqk0MNTPptVe/xoyWi27y+NRGnTwvn4PQnbvB9kp8QUBiGl/wsfoVBHnQxTmhXJSNt9NHTmcz9EivFA==",
"dev": true,
"license": "MIT",
"dependencies": {
"prism-react-renderer": "^2.4.1"
},
"engines": {
"node": ">=12.13.0"
},
"peerDependencies": {
"tailwindcss": "4.x"
}
},
"node_modules/tailwindcss": { "node_modules/tailwindcss": {
"version": "4.1.18", "version": "4.1.18",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.18.tgz", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.18.tgz",
@@ -4585,6 +4996,20 @@
"typescript": ">=4.8.4 <6.0.0" "typescript": ">=4.8.4 <6.0.0"
} }
}, },
"node_modules/uglify-js": {
"version": "3.19.3",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz",
"integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==",
"dev": true,
"license": "BSD-2-Clause",
"optional": true,
"bin": {
"uglifyjs": "bin/uglifyjs"
},
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/undici-types": { "node_modules/undici-types": {
"version": "6.21.0", "version": "6.21.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
@@ -4609,6 +5034,17 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/validate-npm-package-license": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
"integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"spdx-correct": "^3.0.0",
"spdx-expression-parse": "^3.0.0"
}
},
"node_modules/vite": { "node_modules/vite": {
"version": "7.3.0", "version": "7.3.0",
"resolved": "https://registry.npmjs.org/vite/-/vite-7.3.0.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.0.tgz",
@@ -4714,6 +5150,16 @@
"node": ">=18" "node": ">=18"
} }
}, },
"node_modules/walk-up-path": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/walk-up-path/-/walk-up-path-4.0.0.tgz",
"integrity": "sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A==",
"dev": true,
"license": "ISC",
"engines": {
"node": "20 || >=22"
}
},
"node_modules/webidl-conversions": { "node_modules/webidl-conversions": {
"version": "8.0.1", "version": "8.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz",
@@ -4777,6 +5223,13 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/wordwrap": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
"integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==",
"dev": true,
"license": "MIT"
},
"node_modules/wrap-ansi": { "node_modules/wrap-ansi": {
"version": "6.2.0", "version": "6.2.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
+9 -3
View File
@@ -1,7 +1,7 @@
{ {
"name": "sharpbinv3.client", "name": "sharpbinv3.client",
"private": true, "private": true,
"version": "3.0.0", "version": "3.0.2",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite dev", "dev": "vite dev",
@@ -11,7 +11,8 @@
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"format": "prettier --write .", "format": "prettier --write .",
"lint": "prettier --check . && eslint ." "lint": "prettier --check . && eslint .",
"change-log": "conventional-changelog -p angular -i ../CHANGELOG.md -s -r 0"
}, },
"devDependencies": { "devDependencies": {
"@eslint/compat": "^1.4.0", "@eslint/compat": "^1.4.0",
@@ -22,7 +23,10 @@
"@tailwindcss/vite": "^4.1.17", "@tailwindcss/vite": "^4.1.17",
"@types/jsdom": "^27.0.0", "@types/jsdom": "^27.0.0",
"@types/node": "^22", "@types/node": "^22",
"@types/papaparse": "^5.5.2",
"@types/qrcode": "^1.5.6", "@types/qrcode": "^1.5.6",
"conventional-changelog": "^7.1.1",
"conventional-changelog-angular": "^8.1.0",
"eslint": "^9.39.1", "eslint": "^9.39.1",
"eslint-config-prettier": "^10.1.8", "eslint-config-prettier": "^10.1.8",
"eslint-plugin-svelte": "^3.13.1", "eslint-plugin-svelte": "^3.13.1",
@@ -30,8 +34,9 @@
"prettier": "^3.7.4", "prettier": "^3.7.4",
"prettier-plugin-svelte": "^3.4.0", "prettier-plugin-svelte": "^3.4.0",
"prettier-plugin-tailwindcss": "^0.7.2", "prettier-plugin-tailwindcss": "^0.7.2",
"svelte": "^5.45.6", "svelte": "^5.48.3",
"svelte-check": "^4.3.4", "svelte-check": "^4.3.4",
"tailwind-scrollbar": "^4.0.2",
"tailwindcss": "^4.1.17", "tailwindcss": "^4.1.17",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"typescript-eslint": "^8.48.1", "typescript-eslint": "^8.48.1",
@@ -45,6 +50,7 @@
"highlight.js": "^11.8.0", "highlight.js": "^11.8.0",
"jsdom": "^27.4.0", "jsdom": "^27.4.0",
"marked": "^17.0.1", "marked": "^17.0.1",
"papaparse": "^5.5.3",
"qrcode": "^1.5.4" "qrcode": "^1.5.4"
} }
} }
@@ -16,6 +16,8 @@
let isOpen = false; let isOpen = false;
let searchQuery = ''; let searchQuery = '';
let dropdownElement: HTMLDivElement; let dropdownElement: HTMLDivElement;
let dropdownListElement: HTMLDivElement;
let dropdownMaxHeight = '12rem';
$: filteredOptions = searchable $: filteredOptions = searchable
? options.filter( ? options.filter(
@@ -39,10 +41,18 @@
function toggleDropdown() { function toggleDropdown() {
isOpen = !isOpen; isOpen = !isOpen;
if (isOpen && searchable) { if (isOpen) {
setTimeout(() => { setTimeout(() => {
const input = dropdownElement?.querySelector('input[type="text"]') as HTMLInputElement; if (dropdownElement && dropdownListElement) {
input?.focus(); const rect = dropdownElement.getBoundingClientRect();
const spaceBelow = window.innerHeight - rect.bottom - 8;
const maxCap = 416;
dropdownMaxHeight = Math.max(120, Math.min(spaceBelow, maxCap)) + 'px';
}
if (searchable) {
const input = dropdownElement?.querySelector('input[type="text"]') as HTMLInputElement;
input?.focus();
}
}, 0); }, 0);
} }
} }
@@ -70,19 +80,25 @@
<div <div
class="absolute top-full z-50 mt-1 w-full rounded border border-neutral-700 bg-neutral-800 shadow-lg" class="absolute top-full z-50 mt-1 w-full rounded border border-neutral-700 bg-neutral-800 shadow-lg"
class:dropdown-sm-list={variant === 'sm'} class:dropdown-sm-list={variant === 'sm'}
bind:this={dropdownListElement}
style="max-height: {dropdownMaxHeight}; width: 100%;"
> >
{#if searchable} {#if searchable}
<input <div style="position: sticky; top: 0; z-index: 1; background: inherit;">
type="text" <input
placeholder="Search..." type="text"
class="w-full border-b border-neutral-700 bg-neutral-800 p-2 outline-none" placeholder="Search..."
class:dropdown-sm-input={variant === 'sm'} class="w-full border-b border-neutral-700 bg-neutral-800 p-2 outline-none"
bind:value={searchQuery} class:dropdown-sm-input={variant === 'sm'}
on:keydown={handleKeyDown} bind:value={searchQuery}
/> on:keydown={handleKeyDown}
/>
</div>
{/if} {/if}
<div
<div class="max-h-48 overflow-y-auto"> class="scrollbar-thin scrollbar-thumb-neutral-600 scrollbar-track-neutral-700"
style="overflow-y: auto; max-height: calc({dropdownMaxHeight} - 3rem);"
>
{#each filteredOptions as option (option.value)} {#each filteredOptions as option (option.value)}
<button <button
type="button" type="button"
@@ -20,6 +20,7 @@
export let error = ''; export let error = '';
export let placeholder = ''; export let placeholder = '';
export let inputType = 'text'; export let inputType = 'text';
export let inputMaxLength: number | null = null;
export let items: { label: string; value: unknown }[] = []; export let items: { label: string; value: unknown }[] = [];
export let initialValue: unknown = null; export let initialValue: unknown = null;
export let totpActive: boolean | null = null; export let totpActive: boolean | null = null;
@@ -230,7 +231,9 @@
} }
turnstileWidgetId = window.turnstile.render(turnstileEl, { turnstileWidgetId = window.turnstile.render(turnstileEl, {
sitekey: reportSiteKey, sitekey: reportSiteKey,
theme: 'dark' theme: 'dark',
size: 'flexible',
appearence: 'interaction-only'
}); });
}; };
if (window.turnstile) { if (window.turnstile) {
@@ -475,20 +478,19 @@
{/if} {/if}
<textarea <textarea
bind:value={inputValue} bind:value={inputValue}
maxlength="1000" maxlength={inputMaxLength ?? undefined}
placeholder={placeholder || 'Describe the issue'} placeholder={placeholder || 'Describe the issue'}
class="h-28 w-full resize-none rounded border border-neutral-700 bg-neutral-800 p-2 text-white outline-none" class="h-28 w-full resize-none rounded border border-neutral-700 bg-neutral-800 p-2 text-white outline-none"
></textarea> ></textarea>
{#if reportSiteKey} {#if reportSiteKey}
<div class="flex justify-center"> <div class="cf-turnstile w-full" bind:this={turnstileEl}></div>
<div class="cf-turnstile" bind:this={turnstileEl}></div>
</div>
{/if} {/if}
{/if} {/if}
</div> </div>
{:else if shouldShowInput} {:else if shouldShowInput}
<input <input
type={inputType} type={inputType}
maxlength={inputMaxLength ?? undefined}
bind:value={inputValue} bind:value={inputValue}
class="mb-3 w-full rounded border border-neutral-700 bg-neutral-800 p-2 text-white outline-none" class="mb-3 w-full rounded border border-neutral-700 bg-neutral-800 p-2 text-white outline-none"
{placeholder} {placeholder}
@@ -13,6 +13,7 @@
error={state.error} error={state.error}
placeholder={state.placeholder} placeholder={state.placeholder}
inputType={state.inputType} inputType={state.inputType}
inputMaxLength={state.maxInputLength ?? null}
items={state.items} items={state.items}
initialValue={state.initialValue} initialValue={state.initialValue}
totpActive={state.totpActive} totpActive={state.totpActive}
@@ -7,6 +7,7 @@
import type { PageData } from '../../routes/$types'; import type { PageData } from '../../routes/$types';
import { slide } from 'svelte/transition'; import { slide } from 'svelte/transition';
import { Menu, X } from '@lucide/svelte'; import { Menu, X } from '@lucide/svelte';
import { onMount } from 'svelte';
function logout() { function logout() {
clearTokens(); clearTokens();
@@ -23,9 +24,24 @@
currentPath !== '/' && !currentPath.startsWith('/login') && !currentPath.startsWith('/register') currentPath !== '/' && !currentPath.startsWith('/login') && !currentPath.startsWith('/register')
? `?return=${encodeURIComponent(page.url.pathname + page.url.search)}` ? `?return=${encodeURIComponent(page.url.pathname + page.url.search)}`
: ''; : '';
function handleClickOutside(event: MouseEvent) {
const navbar = document.getElementById('navbar');
const mobileMenu = document.getElementById('mobile-menu');
if (menuOpen && mobileMenu && navbar && !navbar.contains(event.target as Node)) {
menuOpen = false;
}
}
onMount(() => {
document.addEventListener('click', handleClickOutside);
return () => {
document.removeEventListener('click', handleClickOutside);
};
});
</script> </script>
<div class="top-0 left-0 z-100 h-15 w-full bg-neutral-900"> <div class="top-0 left-0 z-100 h-15 w-full bg-neutral-900" id="navbar">
<div class="mx-auto hidden h-15 w-[95%] max-w-7xl items-center py-2 md:flex"> <div class="mx-auto hidden h-15 w-[95%] max-w-7xl items-center py-2 md:flex">
<div> <div>
<a href={resolve('/')} class="text-xl font-bold text-white hover:text-neutral-300">Sharpbin</a <a href={resolve('/')} class="text-xl font-bold text-white hover:text-neutral-300">Sharpbin</a
@@ -80,15 +96,16 @@
aria-expanded={menuOpen} aria-expanded={menuOpen}
> >
{#if menuOpen} {#if menuOpen}
<X class="h-6 w-6 text-white" /> <X class="pointer-events-none h-6 w-6 text-white" />
{:else} {:else}
<Menu class="h-6 w-6 text-white" /> <Menu class="pointer-events-none h-6 w-6 text-white" />
{/if} {/if}
</button> </button>
</div> </div>
{#if menuOpen} {#if menuOpen}
<div <div
class="mx-auto mb-2 w-full rounded-b border-b border-neutral-800 bg-neutral-900 px-2 py-3 md:hidden" class="mx-auto mb-2 w-full rounded-b border-b border-neutral-800 bg-neutral-900 px-2 py-3 md:hidden"
id="mobile-menu"
in:slide={{ duration: 180 }} in:slide={{ duration: 180 }}
out:slide={{ duration: 180 }} out:slide={{ duration: 180 }}
style="z-index:1000;position:relative;" style="z-index:1000;position:relative;"
+143 -55
View File
@@ -7,89 +7,177 @@
formatBytes formatBytes
} from '$lib/utils/misc'; } from '$lib/utils/misc';
import { resolve } from '$app/paths'; import { resolve } from '$app/paths';
import { Eye, FileBox, Code, User, History, Calendar, Timer } from '@lucide/svelte'; import {
Eye,
FileBox,
Code,
User,
History,
Calendar,
Timer,
Lock,
EyeOff,
Globe
} from '@lucide/svelte';
import { syntaxes } from '$lib/consts'; import { syntaxes } from '$lib/consts';
import type { Paste } from '$lib/types/paste'; import type { Paste } from '$lib/types/paste';
export let paste: Paste; export let paste: Paste;
export let now: Date; export let now: Date;
export let showUser: boolean = true;
export let compact: boolean = false;
const createdAt = extractDateFromUUIDv7(paste.uuid); const createdAt = extractDateFromUUIDv7(paste.uuid);
const syntax = syntaxes[paste.syntax] ?? syntaxes['plaintext']; const syntax = syntaxes[paste.syntax] ?? syntaxes['plaintext'];
</script> </script>
<a {#if compact}
href={resolve(`/${paste.id}`)} <a
class="flex flex-col gap-2 rounded border border-neutral-700 bg-neutral-800 px-5 py-4 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none" href={resolve(`/${paste.id}`)}
> class="flex flex-col gap-1 rounded border border-neutral-700 bg-neutral-800 px-4 py-3 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none"
<span
class="w-fit max-w-full truncate text-lg font-semibold text-neutral-100 hover:text-white"
use:tooltip={paste.title || 'Untitled Paste'}
> >
{paste.title || 'Untitled Paste'} <div class="flex w-full flex-row justify-between">
</span> <span
<div class="flex flex-row justify-between"> class="text-md w-fit max-w-full truncate font-semibold text-neutral-100 hover:text-white"
<div> use:tooltip={paste.title || 'Untitled Paste'}
>
{paste.title || 'Untitled Paste'}
</span>
<div <div
class="flex items-center gap-2 text-sm text-neutral-400" class="flex items-center gap-2 text-sm text-neutral-400"
use:tooltip={`${createdAt?.toLocaleString()} • ${dateToRelativeString(createdAt ?? new Date(), true, false, now)}`} use:tooltip={`${createdAt?.toLocaleString()} • ${dateToRelativeString(createdAt ?? new Date(), true, false, now)}`}
> >
<Calendar class="h-4 w-4" /> <Calendar class="h-4 w-4" />
<span> {#if createdAt}
{#if createdAt} {#if createdAt.getTime() > Date.now() - 86_400_000}
{#if createdAt.getTime() > Date.now() - 86_400_000} Created {dateToRelativeString(createdAt, true, false, now)}
Created {dateToRelativeString(createdAt, true, false, now)}
{:else}
Created on {createdAt.toLocaleDateString()}
{/if}
{:else} {:else}
Creation date unknown Created on {createdAt.toLocaleDateString()}
{/if} {/if}
</span> {:else}
Creation date unknown
{/if}
</div> </div>
{#if paste.expiresAt > 0} </div>
<div class="flex flex-row justify-between text-sm text-neutral-400">
<div>
{#if showUser}
<div class="flex items-center gap-2">
<User class="h-4 w-4" />
{paste.author?.username ?? 'Anonymous'}
</div>
{:else}
<div class="flex items-center gap-2">
{#if paste.visibility === 0}
<Globe class="h-4 w-4" />
Public
{:else if paste.visibility === 1}
<EyeOff class="h-4 w-4" />
Unlisted
{:else}
<Lock class="h-4 w-4" />
Private
{/if}
</div>
{/if}
<div class="flex items-center gap-2">
<Eye class="h-4 w-4" />
{formatNumber(paste.views)} View{paste.views !== 1 ? 's' : ''}
</div>
</div>
<div>
<div <div
class="mt-1 flex items-center gap-2 text-sm text-neutral-400" class="flex items-center gap-2"
use:tooltip={new Date(paste.expiresAt).toLocaleString()} use:tooltip={paste.isCompressed ? `Compressed Size: ${formatBytes(paste.size)}` : ''}
> >
<Timer class="h-4 w-4" /> <FileBox class="h-4 w-4" />
{formatBytes(paste.trueSize)}
</div>
<div class="flex items-center gap-2">
<Code class="h-4 w-4" />
{syntax.name}
</div>
</div>
</div>
</a>
{:else}
<a
href={resolve(`/${paste.id}`)}
class="flex flex-col gap-2 rounded border border-neutral-700 bg-neutral-800 px-5 py-4 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none"
>
<span
class="w-fit max-w-full truncate text-lg font-semibold text-neutral-100 hover:text-white"
use:tooltip={paste.title || 'Untitled Paste'}
>
{paste.title || 'Untitled Paste'}
</span>
<div class="flex flex-row justify-between">
<div>
<div
class="flex items-center gap-2 text-sm text-neutral-400"
use:tooltip={`${createdAt?.toLocaleString()} • ${dateToRelativeString(createdAt ?? new Date(), true, false, now)}`}
>
<Calendar class="h-4 w-4" />
<span> <span>
{paste.expiresAt > 0 && paste.expiresAt < Date.now() {#if createdAt}
? `Expired ${dateToRelativeString(new Date(paste.expiresAt), true, false, now)}` {#if createdAt.getTime() > Date.now() - 86_400_000}
: `Expires in ${dateToRelativeString(new Date(paste.expiresAt), true, false, now)}`} Created {dateToRelativeString(createdAt, true, false, now)}
{:else}
Created on {createdAt.toLocaleDateString()}
{/if}
{:else}
Creation date unknown
{/if}
</span> </span>
</div> </div>
{/if} {#if paste.editedAt}
<div class="mt-1 flex items-center gap-2 text-sm text-neutral-400"> <div
<User class="h-4 w-4" /> class="mt-1 flex items-center gap-2 text-sm text-neutral-400"
<span>{paste.author?.username ?? 'Anonymous'}</span> use:tooltip={new Date(paste.editedAt).toLocaleString()}
>
<History class="h-4 w-4" />
<span>Edited {dateToRelativeString(new Date(paste.editedAt), true, false, now)}</span>
</div>
{/if}
{#if paste.expiresAt > 0}
<div
class="mt-1 flex items-center gap-2 text-sm text-neutral-400"
use:tooltip={new Date(paste.expiresAt).toLocaleString()}
>
<Timer class="h-4 w-4" />
<span>
{paste.expiresAt > 0 && paste.expiresAt < Date.now()
? `Expired ${dateToRelativeString(new Date(paste.expiresAt), true, false, now)}`
: `Expires in ${dateToRelativeString(new Date(paste.expiresAt), true, false, now)}`}
</span>
</div>
{/if}
{#if showUser}
<div class="mt-1 flex items-center gap-2 text-sm text-neutral-400">
<User class="h-4 w-4" />
<span>{paste.author?.username ?? 'Anonymous'}</span>
</div>
{/if}
</div> </div>
{#if paste.editedAt} <div>
<div class="flex items-center gap-2 text-sm text-neutral-400">
<Eye class="h-4 w-4" />
<span>{formatNumber(paste.views)} View{paste.views !== 1 ? 's' : ''}</span>
</div>
<div <div
class="mt-1 flex items-center gap-2 text-sm text-neutral-400" class="mt-1 flex items-center gap-2 text-sm text-neutral-400"
use:tooltip={new Date(paste.editedAt).toLocaleString()} use:tooltip={paste.isCompressed ? `Compressed Size: ${formatBytes(paste.size)}` : ''}
> >
<History class="h-4 w-4" /> <FileBox class="h-4 w-4" />
<span>Edited {dateToRelativeString(new Date(paste.editedAt), true, false, now)}</span> <span>{formatBytes(paste.trueSize)}</span>
</div>
<div class="mt-1 flex items-center gap-2 text-sm text-neutral-400">
<Code class="h-4 w-4" />
<span>{syntax.name}</span>
</div> </div>
{/if}
</div>
<div>
<div class="flex items-center gap-2 text-sm text-neutral-400">
<Eye class="h-4 w-4" />
<span>{formatNumber(paste.views)} View{paste.views !== 1 ? 's' : ''}</span>
</div>
<div
class="mt-1 flex items-center gap-2 text-sm text-neutral-400"
use:tooltip={paste.isCompressed ? `Compressed Size: ${formatBytes(paste.size)}` : ''}
>
<FileBox class="h-4 w-4" />
<span>{formatBytes(paste.trueSize)}</span>
</div>
<div class="mt-1 flex items-center gap-2 text-sm text-neutral-400">
<Code class="h-4 w-4" />
<span>{syntax.name}</span>
</div> </div>
</div> </div>
</div> </a>
</a> {/if}
+21
View File
@@ -34,6 +34,7 @@ export const syntaxes: Record<string, Syntax> = {
crystal: { name: 'Crystal', extension: '.cr' }, crystal: { name: 'Crystal', extension: '.cr' },
csharp: { name: 'C#', extension: '.cs' }, csharp: { name: 'C#', extension: '.cs' },
css: { name: 'CSS', extension: '.css' }, css: { name: 'CSS', extension: '.css' },
csv: { name: 'CSV', extension: '.csv' },
cue: { name: 'CUE', extension: '.cue' }, cue: { name: 'CUE', extension: '.cue' },
d: { name: 'D', extension: '.d' }, d: { name: 'D', extension: '.d' },
dart: { name: 'Dart', extension: '.dart' }, dart: { name: 'Dart', extension: '.dart' },
@@ -156,6 +157,26 @@ export const syntaxes: Record<string, Syntax> = {
zenscript: { name: 'ZenScript', extension: '.zs' } zenscript: { name: 'ZenScript', extension: '.zs' }
}; };
export const expiresOptions = [
{ value: 0, label: 'Never Expire' },
{ value: 30000, label: 'Expire in 5 Minutes' },
{ value: 600000, label: 'Expire in 10 Minutes' },
{ value: 1800000, label: 'Expire in 30 Minutes' },
{ value: 3600000, label: 'Expire in 1 Hour' },
{ value: 21600000, label: 'Expire in 6 Hours' },
{ value: 43200000, label: 'Expire in 12 Hours' },
{ value: 86400000, label: 'Expire in 1 Day' },
{ value: 604800000, label: 'Expire in 1 Week' },
{ value: 1209600000, label: 'Expire in 2 Weeks' },
{ value: 2592000000, label: 'Expire in 1 Month' },
{ value: 7776000000, label: 'Expire in 3 Months' },
{ value: 15552000000, label: 'Expire in 6 Months' },
{ value: 31536000000, label: 'Expire in 1 Year' },
{ value: 63072000000, label: 'Expire in 2 Years' },
{ value: 157680000000, label: 'Expire in 5 Years' },
{ value: 315360000000, label: 'Expire in 10 Years' }
];
export const roles = { export const roles = {
0: 'User', 0: 'User',
1: 'Moderator', 1: 'Moderator',
@@ -20,6 +20,7 @@ type ModalState = {
error: string; error: string;
placeholder: string; placeholder: string;
inputType: string; inputType: string;
maxInputLength?: number;
items: ModalItem[]; items: ModalItem[];
initialValue: unknown; initialValue: unknown;
totpActive: boolean | null; totpActive: boolean | null;
@@ -42,6 +43,7 @@ const initialState: ModalState = {
error: '', error: '',
placeholder: '', placeholder: '',
inputType: 'text', inputType: 'text',
maxInputLength: undefined,
items: [], items: [],
initialValue: null, initialValue: null,
totpActive: null, totpActive: null,
+38 -44
View File
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import type { PageData } from './$types'; import type { PageData } from './$types';
import { syntaxes } from '$lib/consts'; import { syntaxes, expiresOptions } from '$lib/consts';
import { user } from '$lib/stores/user'; import { user } from '$lib/stores/user';
import { getToken } from '$lib/utils/auth'; import { getToken } from '$lib/utils/auth';
import { onMount } from 'svelte'; import { onMount } from 'svelte';
@@ -21,6 +21,7 @@
export let data: PageData; export let data: PageData;
let textArea: HTMLTextAreaElement; let textArea: HTMLTextAreaElement;
let markdownConatiner: HTMLDivElement;
let error = ''; let error = '';
let title = ''; let title = '';
@@ -54,25 +55,34 @@
renderedMarkdown = await parseMarkdown(content, false); renderedMarkdown = await parseMarkdown(content, false);
} }
previewMode = toPreview; previewMode = toPreview;
if (!toPreview) { requestAnimationFrame(() => resize(previewMode));
requestAnimationFrame(resize);
}
} }
function resize() { function resize(markdown: boolean = false) {
if (!textArea) return; if ((!markdown && !textArea) || (markdown && !markdownConatiner)) return;
textArea.style.height = 'auto'; let h: number;
let max: number;
let element = markdown ? markdownConatiner : textArea;
const h = textArea.scrollHeight; if (!markdown) {
const max = MAX_HEIGHT(); textArea.style.height = 'auto';
h = textArea.scrollHeight;
max = MAX_HEIGHT();
} else {
markdownConatiner.style.height = 'auto';
h = markdownConatiner.scrollHeight;
max = MAX_HEIGHT();
}
if (h > max) { if (h > max) {
textArea.style.height = max + 'px'; element.style.height = max + 'px';
textArea.style.overflowY = 'auto'; element.style.overflowY = 'auto';
} else { } else {
textArea.style.height = h + 'px'; element.style.height = h + 'px';
textArea.style.overflowY = 'hidden'; element.style.overflowY = 'hidden';
} }
} }
@@ -86,7 +96,9 @@
) { ) {
window.turnstile.render('.cf-turnstile', { window.turnstile.render('.cf-turnstile', {
sitekey: data.auth.cf_turnstile_site_key, sitekey: data.auth.cf_turnstile_site_key,
theme: 'dark' theme: 'dark',
size: 'flexible',
appearence: 'interaction-only'
}); });
} }
}; };
@@ -108,22 +120,6 @@
label: syntaxes[lang]?.name ?? lang.charAt(0).toUpperCase() + lang.slice(1) label: syntaxes[lang]?.name ?? lang.charAt(0).toUpperCase() + lang.slice(1)
})) ?? []; })) ?? [];
const expiresOptions = [
{ value: 0, label: 'Never Expire' },
{ value: 600000, label: 'Expire in 10 Minutes' },
{ value: 3600000, label: 'Expire in 1 Hour' },
{ value: 86400000, label: 'Expire in 1 Day' },
{ value: 604800000, label: 'Expire in 1 Week' },
{ value: 1209600000, label: 'Expire in 2 Weeks' },
{ value: 2592000000, label: 'Expire in 1 Month' },
{ value: 7776000000, label: 'Expire in 3 Months' },
{ value: 15552000000, label: 'Expire in 6 Months' },
{ value: 31536000000, label: 'Expire in 1 Year' },
{ value: 63072000000, label: 'Expire in 2 Years' },
{ value: 157680000000, label: 'Expire in 5 Years' },
{ value: 315360000000, label: 'Expire in 10 Years' }
];
const visibilityOptions = const visibilityOptions =
data.options?.visibilities?.map((visibility: { value: number; displayName: string }) => ({ data.options?.visibilities?.map((visibility: { value: number; displayName: string }) => ({
value: visibility.value, value: visibility.value,
@@ -244,7 +240,7 @@
<input <input
type="text" type="text"
placeholder="Title (optional)" placeholder="Title (optional)"
class="mb-4 w-full rounded border border-neutral-700 bg-neutral-800 p-2" class="mb-2 w-full rounded border border-neutral-700 bg-neutral-800 p-2"
spellcheck="false" spellcheck="false"
autocomplete="off" autocomplete="off"
bind:value={title} bind:value={title}
@@ -256,7 +252,9 @@
<div <div
class="markdown min-h-20 w-full overflow-y-auto rounded rounded-b-none border border-neutral-700 bg-neutral-800 p-2 transition-colors duration-200" class="markdown min-h-20 w-full overflow-y-auto rounded rounded-b-none border border-neutral-700 bg-neutral-800 p-2 transition-colors duration-200"
style="height: {previewHeight}" style="height: {previewHeight}"
bind:this={markdownConatiner}
> >
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
{@html renderedMarkdown} {@html renderedMarkdown}
</div> </div>
{:else} {:else}
@@ -268,9 +266,9 @@
minlength="1" minlength="1"
bind:this={textArea} bind:this={textArea}
bind:value={content} bind:value={content}
on:input={resize} on:input={() => resize()}
on:change={resize} on:change={() => resize()}
on:focus={resize} on:focus={() => resize()}
on:beforeinput={(e) => { on:beforeinput={(e) => {
if (!data.options?.maxPasteSize) return; if (!data.options?.maxPasteSize) return;
@@ -299,7 +297,7 @@
isDragging = false; isDragging = false;
}} }}
on:drop={(e) => { on:drop={(e) => {
requestAnimationFrame(resize); requestAnimationFrame(() => resize());
e.preventDefault(); e.preventDefault();
isDragging = false; isDragging = false;
@@ -363,7 +361,7 @@
<div class="mt-1 flex"> <div class="mt-1 flex">
{#if selectedSyntax === 'markdown'} {#if selectedSyntax === 'markdown'}
<div <div
class="monospace mb-2 flex h-12 w-36 items-center justify-between gap-1 rounded-bl border border-neutral-700 bg-neutral-800 p-1 text-sm text-neutral-400 md:h-8" class="monospace mb-2 flex min-h-full w-36 items-center justify-between gap-1 rounded-bl border border-neutral-700 bg-neutral-800 p-1 text-sm text-neutral-400 md:h-8"
> >
<button <button
type="button" type="button"
@@ -386,10 +384,10 @@
</div> </div>
{/if} {/if}
<div <div
class="monospace mb-2 flex h-12 items-center justify-between {selectedSyntax === class="monospace mb-2 flex h-fit min-h-12 items-center justify-between {selectedSyntax ===
'markdown' 'markdown'
? 'ml-auto w-[calc(100%-150px)] rounded-br' ? 'ml-auto w-[calc(100%-150px)] rounded-br'
: 'w-full rounded-b'} border border-neutral-700 bg-neutral-800 p-1 pr-2 pl-2 text-sm text-neutral-400 md:h-8" : 'w-full rounded-b'} border border-neutral-700 bg-neutral-800 p-1 pr-2 pl-2 text-sm text-neutral-400 md:h-8 md:min-h-8"
> >
<div class="flex flex-col md:flex-row md:gap-2"> <div class="flex flex-col md:flex-row md:gap-2">
<span> <span>
@@ -430,7 +428,7 @@
/> />
</div> </div>
{#if selectedVisibility === 2} {#if selectedVisibility === 2}
<div class="flex w-full mb-2"> <div class="mb-2 flex w-full">
<input <input
type={passwordVisible ? 'text' : 'password'} type={passwordVisible ? 'text' : 'password'}
placeholder="Password for private paste" placeholder="Password for private paste"
@@ -479,11 +477,7 @@
</label> </label>
{/if} {/if}
{#if data.options?.requiresVerification && data.auth?.cf_turnstile_site_key} {#if data.options?.requiresVerification && data.auth?.cf_turnstile_site_key}
<div <div class="cf-turnstile mb-1 w-full" data-sitekey={data.auth.cf_turnstile_site_key}></div>
class="mb-2 flex min-h-16.25 w-auto items-center justify-center rounded border border-neutral-700 bg-neutral-800 p-2 pb-1"
>
<div class="cf-turnstile" data-sitekey={data.auth.cf_turnstile_site_key}></div>
</div>
{/if} {/if}
<button <button
type="submit" type="submit"
+140 -45
View File
@@ -1,12 +1,14 @@
<script lang="ts"> <script lang="ts">
import hljs from 'highlight.js'; import hljs from 'highlight.js';
import Papa from 'papaparse';
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import type { PageData } from './$types'; import type { PageData } from './$types';
import { import {
File, File,
FileBox, FileBox,
Eye, Eye,
EyeClosed, Globe,
Lock,
EyeOff, EyeOff,
User, User,
CalendarDays, CalendarDays,
@@ -32,7 +34,7 @@
isBinaryData isBinaryData
} from '$lib/utils/misc'; } from '$lib/utils/misc';
import { parseMarkdown } from '$lib/utils/markdown'; import { parseMarkdown } from '$lib/utils/markdown';
import { syntaxes } from '$lib/consts'; import { syntaxes, expiresOptions } from '$lib/consts';
import { resolve } from '$app/paths'; import { resolve } from '$app/paths';
import { decryptAES, encryptAES } from '$lib/utils/encryption'; import { decryptAES, encryptAES } from '$lib/utils/encryption';
import { fade } from 'svelte/transition'; import { fade } from 'svelte/transition';
@@ -73,21 +75,7 @@
value: lang, value: lang,
label: syntaxes[lang]?.name ?? lang.charAt(0).toUpperCase() + lang.slice(1) label: syntaxes[lang]?.name ?? lang.charAt(0).toUpperCase() + lang.slice(1)
})) ?? []; })) ?? [];
const expiresOptions = [
{ value: 0, label: 'Never Expire' },
{ value: 600000, label: 'Expire in 10 Minutes' },
{ value: 3600000, label: 'Expire in 1 Hour' },
{ value: 86400000, label: 'Expire in 1 Day' },
{ value: 604800000, label: 'Expire in 1 Week' },
{ value: 1209600000, label: 'Expire in 2 Weeks' },
{ value: 2592000000, label: 'Expire in 1 Month' },
{ value: 7776000000, label: 'Expire in 3 Months' },
{ value: 15552000000, label: 'Expire in 6 Months' },
{ value: 31536000000, label: 'Expire in 1 Year' },
{ value: 63072000000, label: 'Expire in 2 Years' },
{ value: 157680000000, label: 'Expire in 5 Years' },
{ value: 315360000000, label: 'Expire in 10 Years' }
];
const visibilityOptions = const visibilityOptions =
data.options?.visibilities?.map((visibility: { value: number; displayName: string }) => ({ data.options?.visibilities?.map((visibility: { value: number; displayName: string }) => ({
value: visibility.value, value: visibility.value,
@@ -125,27 +113,38 @@
return html.replace(code, numbered); return html.replace(code, numbered);
} }
async function renderCode(content: string | null = null) { async function renderPaste(content: string | null = null) {
if (!data?.paste) return; if (!data?.paste) return;
let code = content ?? decryptedContent ?? data.content ?? '';
const encoder = new TextEncoder(); let contentToRender = content ?? decryptedContent ?? data.content ?? '';
const buffer = encoder.encode(code).buffer;
isBinary = isBinaryData(buffer); isBinary = isBinaryData(new TextEncoder().encode(contentToRender).buffer);
if (isBinary) { if (isBinary) {
contentRendered = true; contentRendered = true;
decryptStatus = ''; decryptStatus = '';
return; return;
} }
const lang = (data.paste.syntax ?? '').toLowerCase(); switch (data.paste.syntax) {
case 'markdown':
if (lang === 'markdown') { pasteContent = await parseMarkdown(contentToRender);
pasteContent = await parseMarkdown(code); contentRendered = true;
contentRendered = true; decryptStatus = '';
decryptStatus = ''; break;
return; case 'csv':
await renderCsv(contentToRender);
break;
default:
await renderCode(contentToRender);
break;
} }
}
async function renderCode(content: string | null = null) {
if (!data?.paste) return;
let code = content ?? decryptedContent ?? data.content ?? '';
const lang = (data.paste.syntax ?? '').toLowerCase();
let highlighted = ''; let highlighted = '';
try { try {
@@ -173,6 +172,52 @@
decryptStatus = ''; decryptStatus = '';
} }
async function renderCsv(content: string) {
try {
const results = Papa.parse(content, {
header: false,
skipEmptyLines: true,
dynamicTyping: false
});
if (!results.data || results.data.length === 0) {
pasteContent = '<div class="p-4 text-neutral-400">No data in CSV</div>';
contentRendered = true;
decryptStatus = '';
return;
}
const rows = results.data as string[][];
const [header, ...body] = rows;
const escape = (v: string) =>
v.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
const tableHtml = `
<table class="csv-table">
<thead>
<tr>
${header.map((c) => `<th>${c ? escape(c) : ''}</th>`).join('')}
</tr>
</thead>
<tbody>
${body
.map((row) => `<tr>${row.map((c) => `<td>${c ? escape(c) : ''}</td>`).join('')}</tr>`)
.join('')}
</tbody>
</table>
`;
pasteContent = tableHtml;
contentRendered = true;
decryptStatus = '';
} catch {
pasteContent = '<div class="p-4 text-red-400">Failed to parse CSV</div>';
contentRendered = true;
decryptStatus = '';
}
}
async function updatePaste(content: string | null, metadata: Paste | null) { async function updatePaste(content: string | null, metadata: Paste | null) {
editError = ''; editError = '';
editLoading = true; editLoading = true;
@@ -221,7 +266,7 @@
} }
data.content = rawContent; data.content = rawContent;
decryptedContent = rawContent; decryptedContent = rawContent;
await renderCode(rawContent); await renderPaste(rawContent);
} }
if ( if (
(metadata?.syntax !== data.paste.syntax || (metadata?.syntax !== data.paste.syntax ||
@@ -376,14 +421,14 @@
decryptError = 'Incorrect password. Please try again.'; decryptError = 'Incorrect password. Please try again.';
decryptStatus = 'Decryption failed.'; decryptStatus = 'Decryption failed.';
} else { } else {
await renderCode(); await renderPaste();
history.replaceState(null, '', window.location.pathname + window.location.search); history.replaceState(null, '', window.location.pathname + window.location.search);
} }
} else { } else {
decryptStatus = 'Decryption canceled.'; decryptStatus = 'Decryption canceled.';
} }
} else { } else {
await renderCode(); await renderPaste();
} }
return; return;
} }
@@ -396,22 +441,22 @@
decryptError = 'Incorrect password. Please try again.'; decryptError = 'Incorrect password. Please try again.';
decryptStatus = 'Decryption failed.'; decryptStatus = 'Decryption failed.';
} else { } else {
await renderCode(); await renderPaste();
} }
} else { } else {
decryptStatus = 'Decryption canceled.'; decryptStatus = 'Decryption canceled.';
} }
} else { } else {
decryptStatus = 'Rendering content...'; decryptStatus = 'Rendering content...';
await renderCode(); await renderPaste();
} }
} catch { } catch {
decryptStatus = 'Rendering content...'; decryptStatus = 'Rendering content...';
await renderCode(); await renderPaste();
} }
}); });
$: if (data?.paste && (data.paste.visibility !== 2 || decryptedContent !== null)) renderCode(); $: if (data?.paste && (data.paste.visibility !== 2 || decryptedContent !== null)) renderPaste();
$: reportSiteKey = $: reportSiteKey =
(data as unknown as { authOptions?: { cf_turnstile_site_key?: string | null } }).authOptions (data as unknown as { authOptions?: { cf_turnstile_site_key?: string | null } }).authOptions
?.cf_turnstile_site_key ?? null; ?.cf_turnstile_site_key ?? null;
@@ -429,7 +474,7 @@
<meta property="og:title" content={data.paste.title || 'Untitled Paste'} /> <meta property="og:title" content={data.paste.title || 'Untitled Paste'} />
<meta <meta
property="og:description" property="og:description"
content={`A ${data.paste.syntax} paste on Sharpbin created by ${ content={`A ${syntaxes[data.paste.syntax].name} paste on Sharpbin created by ${
data.paste.author ? data.paste.author.username : 'Anonymous' data.paste.author ? data.paste.author.username : 'Anonymous'
}, created on ${ }, created on ${
extractDateFromUUIDv7(data.paste.uuid)?.toLocaleDateString() ?? 'Unknown Date' extractDateFromUUIDv7(data.paste.uuid)?.toLocaleDateString() ?? 'Unknown Date'
@@ -494,9 +539,13 @@
<div class="relative flex shrink-0 items-center"> <div class="relative flex shrink-0 items-center">
<div <div
class="flex" class="flex"
use:tooltip={data.paste.isCompressed use:tooltip={`${
? `Compressed Size: ${formatBytes(data.paste.size)}` data.paste.isCompressed ? `Compressed Size: ${formatBytes(data.paste.size)}` : ''
: `This paste is not compressed.`} }${
data.paste.visibility === 2
? ` • Decrypted Size: ${formatBytes(decryptedContent ? new TextEncoder().encode(decryptedContent).length : 0)}`
: ''
}`}
> >
<FileBox class="mr-2 h-6 w-6 text-neutral-400" /> <FileBox class="mr-2 h-6 w-6 text-neutral-400" />
<span class="text-neutral-400">{formatBytes(data.paste.trueSize)}</span> <span class="text-neutral-400">{formatBytes(data.paste.trueSize)}</span>
@@ -594,13 +643,13 @@
<div> <div>
<div class="flex shrink-0 items-center"> <div class="flex shrink-0 items-center">
{#if data.paste.visibility === 0} {#if data.paste.visibility === 0}
<Eye class="mr-2 h-6 w-6 text-neutral-400" /> <Globe class="mr-2 h-6 w-6 text-neutral-400" />
<span class="text-neutral-400">{editing ? '' : 'Public'}</span> <span class="text-neutral-400">{editing ? '' : 'Public'}</span>
{:else if data.paste.visibility === 1} {:else if data.paste.visibility === 1}
<EyeClosed class="mr-2 h-6 w-6 text-neutral-400" /> <EyeOff class="mr-2 h-6 w-6 text-neutral-400" />
<span class="text-neutral-400">{editing ? '' : 'Unlisted'}</span> <span class="text-neutral-400">{editing ? '' : 'Unlisted'}</span>
{:else if data.paste.visibility === 2} {:else if data.paste.visibility === 2}
<EyeOff class="mr-2 h-6 w-6 text-neutral-400" /> <Lock class="mr-2 h-6 w-6 text-neutral-400" />
<span class="text-neutral-400">{editing ? '' : 'Private'}</span> <span class="text-neutral-400">{editing ? '' : 'Private'}</span>
{/if} {/if}
{#if editing && editMetadata} {#if editing && editMetadata}
@@ -855,12 +904,13 @@
<div <div
class={data.paste.syntax === 'markdown' class={data.paste.syntax === 'markdown'
? 'markdown rounded-b-md bg-neutral-800 p-4' ? 'markdown rounded-b-md bg-neutral-800 p-4'
: 'codeblock-with-lines overflow-x-auto overflow-y-auto'} : data.paste.syntax === 'csv'
? 'csv-container scrollbar overflow-x-auto overflow-y-auto scrollbar-thumb-neutral-600 scrollbar-track-neutral-800'
: 'codeblock-with-lines overflow-x-auto overflow-y-auto'}
class:hidden={!contentRendered} class:hidden={!contentRendered}
on:click={handleMarkdownClick} on:click={handleMarkdownClick}
role="presentation" role="presentation"
> >
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
{@html pasteContent} {@html pasteContent}
</div> </div>
{/if} {/if}
@@ -925,5 +975,50 @@
padding-left: 0.25em; padding-left: 0.25em;
min-width: 0; min-width: 0;
} }
.csv-table {
border-collapse: separate;
border-spacing: 0;
background-color: var(--color-neutral-800);
border-bottom-left-radius: 0.25rem;
border-bottom-right-radius: 0.25rem;
min-width: 100%;
}
.csv-table thead th {
position: sticky;
top: 0;
background-color: var(--color-neutral-800);
border-bottom: 2px solid var(--color-neutral-700);
z-index: 2;
}
.csv-table tbody tr,
.csv-table thead th {
border-bottom: 1px solid var(--color-neutral-700);
}
.csv-table tbody tr:hover,
.csv-table thead tr:hover {
background-color: rgba(255, 255, 255, 0.05);
}
.csv-table tbody td,
.csv-table thead th {
padding: 0.75rem 1rem;
text-align: left;
color: var(--color-neutral-300);
white-space: nowrap;
}
.csv-table tbody tr:last-child {
border-bottom: none;
}
.csv-container {
max-height: 60vh;
border-bottom-left-radius: 0.25rem;
border-bottom-right-radius: 0.25rem;
}
</style> </style>
</main> </main>
+1
View File
@@ -1,5 +1,6 @@
@import 'tailwindcss'; @import 'tailwindcss';
@import 'highlight.js/styles/github-dark.css'; @import 'highlight.js/styles/github-dark.css';
@plugin 'tailwind-scrollbar';
* { * {
box-sizing: border-box; box-sizing: border-box;
@@ -17,7 +17,9 @@
if (window.turnstile && data.options?.cf_turnstile_site_key) { if (window.turnstile && data.options?.cf_turnstile_site_key) {
window.turnstile.render('.cf-turnstile', { window.turnstile.render('.cf-turnstile', {
sitekey: data.options.cf_turnstile_site_key, sitekey: data.options.cf_turnstile_site_key,
theme: 'dark' theme: 'dark',
size: 'flexible',
appearence: 'interaction-only'
}); });
} }
}; };
@@ -130,9 +132,7 @@
/> />
{/if} {/if}
{#if data.options?.cf_turnstile_site_key} {#if data.options?.cf_turnstile_site_key}
<div class="flex w-full justify-center"> <div class="cf-turnstile w-full"></div>
<div class="cf-turnstile"></div>
</div>
{/if} {/if}
<button <button
type="submit" type="submit"
@@ -2,7 +2,7 @@
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { setTokens, startTokenRefreshInterval } from '$lib/utils/auth'; import { setTokens, startTokenRefreshInterval } from '$lib/utils/auth';
import { extractError } from '$lib/utils/misc'; import { extractError } from '$lib/utils/misc';
import { Check, X } from '@lucide/svelte'; import { Check, X, Eye, EyeClosed } from '@lucide/svelte';
import { slide, fade } from 'svelte/transition'; import { slide, fade } from 'svelte/transition';
import { resolve } from '$app/paths'; import { resolve } from '$app/paths';
import { onMount } from 'svelte'; import { onMount } from 'svelte';
@@ -16,8 +16,11 @@
let error = ''; let error = '';
let passwordFocused = false; let passwordFocused = false;
let showPassword = false;
1;
let passwordChecks = { let passwordChecks = {
length: false, minLength: false,
maxLength: false,
upper: false, upper: false,
lower: false, lower: false,
number: false number: false
@@ -36,7 +39,9 @@
) { ) {
window.turnstile.render('.cf-turnstile', { window.turnstile.render('.cf-turnstile', {
sitekey: data.options.cf_turnstile_site_key, sitekey: data.options.cf_turnstile_site_key,
theme: 'dark' theme: 'dark',
size: 'flexible',
appearence: 'interaction-only'
}); });
} }
}; };
@@ -53,12 +58,14 @@
}); });
function validatePassword(pw: string) { function validatePassword(pw: string) {
passwordChecks.length = pw.length >= 8; passwordChecks.minLength = pw.length >= 8;
passwordChecks.maxLength = pw.length <= 128;
passwordChecks.upper = /[A-Z]/.test(pw); passwordChecks.upper = /[A-Z]/.test(pw);
passwordChecks.lower = /[a-z]/.test(pw); passwordChecks.lower = /[a-z]/.test(pw);
passwordChecks.number = /[0-9]/.test(pw); passwordChecks.number = /[0-9]/.test(pw);
passwordValid = passwordValid =
passwordChecks.length && passwordChecks.minLength &&
passwordChecks.maxLength &&
passwordChecks.upper && passwordChecks.upper &&
passwordChecks.lower && passwordChecks.lower &&
passwordChecks.number; passwordChecks.number;
@@ -166,34 +173,61 @@
class="focus:bg-neutral-750 w-full rounded border border-neutral-700 bg-neutral-800 p-2 placeholder-neutral-500 transition-colors duration-200 focus:border-neutral-600" class="focus:bg-neutral-750 w-full rounded border border-neutral-700 bg-neutral-800 p-2 placeholder-neutral-500 transition-colors duration-200 focus:border-neutral-600"
/> />
</div> </div>
<input <div class="flex w-full">
type="password" <input
placeholder="Password" type={showPassword ? 'text' : 'password'}
bind:value={password} placeholder="Password"
required bind:value={password}
on:focus={() => (passwordFocused = true)} required
on:blur={() => (passwordFocused = false)} on:focus={() => (passwordFocused = true)}
autocomplete="new-password" on:blur={() => (passwordFocused = false)}
disabled={loading || !data.options?.registration_enabled} autocomplete="new-password"
class="focus:bg-neutral-750 w-full rounded border border-neutral-700 bg-neutral-800 p-2 placeholder-neutral-500 transition-colors duration-200 focus:border-neutral-600" disabled={loading || !data.options?.registration_enabled}
/> class="focus:bg-neutral-750 w-[calc(100%-40px)] rounded-l border border-neutral-700 bg-neutral-800 p-2 placeholder-neutral-500 transition-colors duration-200 focus:border-neutral-600"
/>
<button
type="button"
on:click={() => (showPassword = !showPassword)}
disabled={loading || !data.options?.registration_enabled}
class="ml-2 flex w-10 items-center rounded-r border border-neutral-700 bg-neutral-800 p-2 transition-colors duration-200 hover:bg-neutral-700 focus:outline-none"
>
{#if showPassword}
<EyeClosed class="h-5 w-5 text-neutral-400" />
{:else}
<Eye class="h-5 w-5 text-neutral-400" />
{/if}
</button>
</div>
{#if passwordFocused} {#if passwordFocused}
<ul <ul
transition:slide transition:slide
class="space-y-2 rounded border border-neutral-700 bg-neutral-800 p-3 text-sm" class="space-y-2 rounded border border-neutral-700 bg-neutral-800 p-3 text-sm"
> >
<li <li
class="flex items-center gap-2 {passwordChecks.length class="flex items-center gap-2 {passwordChecks.minLength
? 'text-green-400' ? 'text-green-400'
: 'text-red-400'}" : 'text-red-400'}"
> >
{#if passwordChecks.length} {#if passwordChecks.minLength}
<Check class="h-4 w-4" /> <Check class="h-4 w-4" />
{:else} {:else}
<X class="h-4 w-4" /> <X class="h-4 w-4" />
{/if} {/if}
At least 8 characters At least 8 characters
</li> </li>
<li
class="flex items-center gap-2 {passwordChecks.maxLength
? 'text-green-400'
: 'text-red-400'}"
>
{#if passwordChecks.maxLength}
<Check class="h-4 w-4" />
{:else}
<X class="h-4 w-4" />
{/if}
No more than 128 characters
</li>
<li <li
class="flex items-center gap-2 {passwordChecks.upper class="flex items-center gap-2 {passwordChecks.upper
? 'text-green-400' ? 'text-green-400'
@@ -241,6 +275,7 @@
disabled={loading || !data.options?.registration_enabled} disabled={loading || !data.options?.registration_enabled}
class="focus:bg-neutral-750 w-full rounded border border-neutral-700 bg-neutral-800 p-2 placeholder-neutral-500 transition-colors duration-200 focus:border-neutral-600" class="focus:bg-neutral-750 w-full rounded border border-neutral-700 bg-neutral-800 p-2 placeholder-neutral-500 transition-colors duration-200 focus:border-neutral-600"
/> />
{#if confirmPassword && password !== confirmPassword} {#if confirmPassword && password !== confirmPassword}
<div <div
transition:fade transition:fade
@@ -250,9 +285,7 @@
</div> </div>
{/if} {/if}
{#if data.options?.cf_turnstile_site_key && data.options?.registration_enabled} {#if data.options?.cf_turnstile_site_key && data.options?.registration_enabled}
<div class="flex w-full justify-center"> <div class="cf-turnstile w-full"></div>
<div class="cf-turnstile"></div>
</div>
{/if} {/if}
<button <button
type="submit" type="submit"
@@ -16,7 +16,12 @@
Hash, Hash,
Flag Flag
} from '@lucide/svelte'; } from '@lucide/svelte';
import { extractDateFromUUIDv7, tooltip, dateToRelativeString } from '$lib/utils/misc'; import {
extractDateFromUUIDv7,
tooltip,
dateToRelativeString,
extractError
} from '$lib/utils/misc';
import { roles } from '$lib/consts'; import { roles } from '$lib/consts';
import { getToken } from '$lib/utils/auth'; import { getToken } from '$lib/utils/auth';
import { needsAdminTotp } from '$lib/utils/totp'; import { needsAdminTotp } from '$lib/utils/totp';
@@ -111,7 +116,7 @@
loading = false; loading = false;
if (!res.ok) { if (!res.ok) {
const err = await res.json(); const err = await res.json();
modalError = err.message || 'Failed to update display name'; modalError = extractError(err) || 'Failed to update user';
await openModal({ await openModal({
mode: 'confirm', mode: 'confirm',
title: 'Error', title: 'Error',
@@ -159,7 +164,7 @@
loading = false; loading = false;
if (!res.ok) { if (!res.ok) {
const err = await res.json(); const err = await res.json();
modalError = err.message || 'Failed to delete account'; modalError = extractError(err) || 'Failed to delete account';
await openModal({ await openModal({
mode: 'confirm', mode: 'confirm',
title: 'Error', title: 'Error',
@@ -185,6 +190,7 @@
await openModal<string>({ await openModal<string>({
mode: 'prompt', mode: 'prompt',
title: 'Edit Display Name', title: 'Edit Display Name',
maxInputLength: 26,
placeholder: 'New Display Name', placeholder: 'New Display Name',
error: modalError, error: modalError,
cancelValue: '' cancelValue: ''
@@ -268,7 +274,7 @@
class="flex min-h-[calc(100vh-120px)] w-full flex-col items-center justify-center pt-5 pb-5 text-white" class="flex min-h-[calc(100vh-120px)] w-full flex-col items-center justify-center pt-5 pb-5 text-white"
> >
<div class="relative w-[95%] max-w-5xl rounded border-2 border-neutral-800 bg-neutral-900 p-6"> <div class="relative w-[95%] max-w-5xl rounded border-2 border-neutral-800 bg-neutral-900 p-6">
<h1 class="flex items-center justify-center gap-4 text-center text-4xl font-bold"> <h1 class="flex flex-wrap items-center justify-center gap-4 text-center text-4xl font-bold">
{#if data.user?.roles?.includes(403)} {#if data.user?.roles?.includes(403)}
<span <span
class="relative flex h-7 w-7 items-center justify-center overflow-hidden rounded-full" class="relative flex h-7 w-7 items-center justify-center overflow-hidden rounded-full"
@@ -288,7 +294,10 @@
<User class="h-8 w-8 text-neutral-400" /> <User class="h-8 w-8 text-neutral-400" />
</span> </span>
{/if} {/if}
<span use:tooltip={data.user?.uuid || 'Unknown UUID'}> <span
use:tooltip={data.user?.uuid || 'Unknown UUID'}
class="max-w-full wrap-break-word whitespace-normal"
>
{data.user?.displayName || data.user?.username} {data.user?.displayName || data.user?.username}
</span> </span>
</h1> </h1>
@@ -413,7 +422,7 @@
<div class="mt-6 max-h-[60vh] space-y-4 overflow-y-auto"> <div class="mt-6 max-h-[60vh] space-y-4 overflow-y-auto">
{#if pastes && pastes.length > 0} {#if pastes && pastes.length > 0}
{#each pastes.slice().sort((a, b) => b.uuid.localeCompare(a.uuid)) as paste (paste.uuid)} {#each pastes.slice().sort((a, b) => b.uuid.localeCompare(a.uuid)) as paste (paste.uuid)}
<Paste {paste} {now} /> <Paste {paste} {now} showUser={false} compact={true} />
{/each} {/each}
{:else} {:else}
<p class="text-center text-neutral-400"> <p class="text-center text-neutral-400">
@@ -423,150 +432,142 @@
</div> </div>
{#if reportsSubmitted || reportsTarget} {#if reportsSubmitted || reportsTarget}
<div class="mt-6 space-y-6"> <div class="mt-6 space-y-6">
{#if reportsSubmitted} {#if reportsSubmitted && reportsSubmitted.reports.length > 0}
<div class="rounded border border-neutral-800 bg-neutral-900/60 p-4"> <div class="rounded border border-neutral-800 bg-neutral-900/60 p-4">
<h2 class="mb-3 text-xl font-semibold text-neutral-200">Submitted Reports</h2> <h2 class="mb-3 text-xl font-semibold text-neutral-200">Submitted Reports</h2>
{#if reportsSubmitted.reports.length > 0} <div class="space-y-3">
<div class="space-y-3"> {#each reportsSubmitted.reports as report (report.reportID)}
{#each reportsSubmitted.reports as report (report.reportID)} <div
<div class="flex cursor-pointer flex-col gap-2 rounded border border-neutral-700 bg-neutral-800 px-5 py-4 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none"
class="flex cursor-pointer flex-col gap-2 rounded border border-neutral-700 bg-neutral-800 px-5 py-4 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none" role="link"
role="link" tabindex="0"
tabindex="0" on:click={() => goto(resolve(`/report/${report.reportID}`))}
on:click={() => goto(resolve(`/report/${report.reportID}`))} on:keydown={(e) => {
on:keydown={(e) => { if (e.key === 'Enter' || e.key === ' ') {
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault();
e.preventDefault(); goto(resolve(`/report/${report.reportID}`));
goto(resolve(`/report/${report.reportID}`)); }
} }}
}} >
> <div class="flex flex-wrap items-center justify-between gap-2">
<div class="flex flex-wrap items-center justify-between gap-2"> <span class="text-lg font-semibold text-neutral-100">
<span class="text-lg font-semibold text-neutral-100"> Report #{report.reportID}
Report #{report.reportID} </span>
</span> <span class="text-sm text-neutral-300">
<span class="text-sm text-neutral-300"> {reportTypeLabels[report.type] ?? 'Other'}
{reportTypeLabels[report.type] ?? 'Other'} · {reportStatusLabels[report.status] ?? 'Open'}
· {reportStatusLabels[report.status] ?? 'Open'} </span>
</span>
</div>
<div class="flex flex-wrap items-center gap-3 text-sm text-neutral-400">
<span>{reportTargetLabels[report.targetType] ?? 'Unknown'}</span>
{#if report.pasteId}
<a
href={resolve(`/${report.pasteId}`)}
class="text-neutral-300 hover:text-white"
on:click|stopPropagation
>
{report.pasteTitle !== '' ? report.pasteTitle : report.pasteId}
</a>
{/if}
{#if report.userUUID}
{#if report.targetUsername}
<a
href={resolve(`/user/${report.targetUsername}`)}
class="text-neutral-300 hover:text-white"
use:tooltip={report.userUUID}
on:click|stopPropagation
>
{report.targetDisplayName || report.targetUsername}
</a>
{:else}
<span>{report.userUUID}</span>
{/if}
{/if}
<span>
Created {new Date(report.createdAt * 1000).toLocaleString()}
</span>
</div>
{#if report.description}
<p class="text-sm text-neutral-300">{report.description}</p>
{/if}
</div> </div>
{/each} <div class="flex flex-wrap items-center gap-3 text-sm text-neutral-400">
</div> <span>{reportTargetLabels[report.targetType] ?? 'Unknown'}</span>
{:else} {#if report.pasteId}
<p class="text-center text-neutral-400">No submitted reports to show.</p> <a
{/if} href={resolve(`/${report.pasteId}`)}
</div> class="text-neutral-300 hover:text-white"
{/if} on:click|stopPropagation
{#if reportsTarget} >
<div class="rounded border border-neutral-800 bg-neutral-900/60 p-4"> {report.pasteTitle !== '' ? report.pasteTitle : report.pasteId}
<h2 class="mb-3 text-xl font-semibold text-neutral-200">Reports About This User</h2> </a>
{#if reportsTarget.reports.length > 0} {/if}
<div class="space-y-3"> {#if report.userUUID}
{#each reportsTarget.reports as report (report.reportID)} {#if report.targetUsername}
<div
class="flex flex-col gap-2 rounded border border-neutral-700 bg-neutral-800 px-5 py-4 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none"
role="link"
tabindex="0"
on:click={() => goto(resolve(`/report/${report.reportID}`))}
on:keydown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
goto(resolve(`/report/${report.reportID}`));
}
}}
>
<div class="flex flex-wrap items-center justify-between gap-2">
<span class="text-lg font-semibold text-neutral-100">
Report #{report.reportID}
</span>
<span class="text-sm text-neutral-300">
{reportTypeLabels[report.type] ?? 'Other'}
· {reportStatusLabels[report.status] ?? 'Open'}
</span>
</div>
<div class="flex flex-wrap items-center gap-3 text-sm text-neutral-400">
<span>{reportTargetLabels[report.targetType] ?? 'Unknown'}</span>
{#if report.reporterUsername}
<a <a
href={resolve(`/user/${report.reporterUsername}`)} href={resolve(`/user/${report.targetUsername}`)}
class="text-neutral-300 hover:text-white" class="text-neutral-300 hover:text-white"
use:tooltip={report.reporterUUID} use:tooltip={report.userUUID}
on:click|stopPropagation on:click|stopPropagation
> >
{report.reporterDisplayName || report.reporterUsername} {report.targetDisplayName || report.targetUsername}
</a> </a>
{:else} {:else}
<span>{report.reporterUUID}</span> <span>{report.userUUID}</span>
{/if} {/if}
{#if report.pastePID} {/if}
<span>
Created {new Date(report.createdAt * 1000).toLocaleString()}
</span>
</div>
{#if report.description}
<p class="text-sm text-neutral-300">{report.description}</p>
{/if}
</div>
{/each}
</div>
</div>
{/if}
{#if reportsTarget && reportsTarget.reports.length > 0}
<div class="rounded border border-neutral-800 bg-neutral-900/60 p-4">
<h2 class="mb-3 text-xl font-semibold text-neutral-200">Reports About This User</h2>
<div class="space-y-3">
{#each reportsTarget.reports as report (report.reportID)}
<div
class="flex cursor-pointer flex-col gap-2 rounded border border-neutral-700 bg-neutral-800 px-5 py-4 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none"
role="link"
tabindex="0"
on:click={() => goto(resolve(`/report/${report.reportID}`))}
on:keydown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
goto(resolve(`/report/${report.reportID}`));
}
}}
>
<div class="flex flex-wrap items-center justify-between gap-2">
<span class="text-lg font-semibold text-neutral-100">
Report #{report.reportID}
</span>
<span class="text-sm text-neutral-300">
{reportTypeLabels[report.type] ?? 'Other'}
· {reportStatusLabels[report.status] ?? 'Open'}
</span>
</div>
<div class="flex flex-wrap items-center gap-3 text-sm text-neutral-400">
<span>{reportTargetLabels[report.targetType] ?? 'Unknown'}</span>
{#if report.reporterUsername}
<a
href={resolve(`/user/${report.reporterUsername}`)}
class="text-neutral-300 hover:text-white"
use:tooltip={report.reporterUUID}
on:click|stopPropagation
>
{report.reporterDisplayName || report.reporterUsername}
</a>
{:else}
<span>{report.reporterUUID}</span>
{/if}
{#if report.pastePID}
<a
href={resolve(`/${report.pasteId ?? report.pastePID}`)}
class="text-neutral-300 hover:text-white"
on:click|stopPropagation
>
{report.pasteTitle ? report.pasteTitle : `Paste #${report.pastePID}`}
</a>
{/if}
{#if report.userUUID}
{#if report.targetUsername}
<a <a
href={resolve(`/${report.pasteId ?? report.pastePID}`)} href={resolve(`/user/${report.targetUsername}`)}
class="text-neutral-300 hover:text-white" class="text-neutral-300 hover:text-white"
use:tooltip={report.userUUID}
on:click|stopPropagation on:click|stopPropagation
> >
{report.pasteTitle ? report.pasteTitle : `Paste #${report.pastePID}`} {report.targetDisplayName || report.targetUsername}
</a> </a>
{:else}
<span>{report.userUUID}</span>
{/if} {/if}
{#if report.userUUID}
{#if report.targetUsername}
<a
href={resolve(`/user/${report.targetUsername}`)}
class="text-neutral-300 hover:text-white"
use:tooltip={report.userUUID}
on:click|stopPropagation
>
{report.targetDisplayName || report.targetUsername}
</a>
{:else}
<span>{report.userUUID}</span>
{/if}
{/if}
<span>
Created {new Date(report.createdAt * 1000).toLocaleString()}
</span>
</div>
{#if report.description}
<p class="text-sm text-neutral-300">{report.description}</p>
{/if} {/if}
<span>
Created {new Date(report.createdAt * 1000).toLocaleString()}
</span>
</div> </div>
{/each} {#if report.description}
</div> <p class="text-sm text-neutral-300">{report.description}</p>
{:else} {/if}
<p class="text-center text-neutral-400">No reports to show.</p> </div>
{/if} {/each}
</div>
</div> </div>
{/if} {/if}
</div> </div>
@@ -31,13 +31,13 @@ namespace SharpbinV3.Server.Controllers
[EnableRateLimiting("Strict")] [EnableRateLimiting("Strict")]
public async Task<IActionResult> CreatePaste(string title = "", string syntax = "plaintext", int visibility = 0, long expiresAt = 0, string? token = null) public async Task<IActionResult> CreatePaste(string title = "", string syntax = "plaintext", int visibility = 0, long expiresAt = 0, string? token = null)
{ {
if (!await _pasteService.ValidateExpiresAt(expiresAt)) if (!_pasteService.ValidateExpiresAt(expiresAt))
return BadRequest(new { success = false, message = "Invalid expiration time." }); return BadRequest(new { success = false, message = "Invalid expiration time." });
if (!await _pasteService.ValidateVisibility(visibility)) if (!_pasteService.ValidateVisibility(visibility))
return BadRequest(new { success = false, message = "Invalid visibility level. Must be between 0 and 2." }); return BadRequest(new { success = false, message = "Invalid visibility level. Must be between 0 and 2." });
if (!await _pasteService.ValidateSyntax(syntax)) if (!_pasteService.ValidateSyntax(syntax))
return BadRequest(new { success = false, message = "Invalid syntax." }); return BadRequest(new { success = false, message = "Invalid syntax." });
if (!await _pasteService.ValidateTitle(title)) if (!_pasteService.ValidateTitle(title))
return BadRequest(new { success = false, message = $"Invalid title. Must be less than {_pasteSettings.MaxTitleLength} characters." }); return BadRequest(new { success = false, message = $"Invalid title. Must be less than {_pasteSettings.MaxTitleLength} characters." });
string content = await new StreamReader(Request.Body).ReadToEndAsync(); string content = await new StreamReader(Request.Body).ReadToEndAsync();
@@ -59,6 +59,7 @@ namespace SharpbinV3.Server.Controllers
{ {
ID = paste.ID, ID = paste.ID,
UUID = paste.UUID, UUID = paste.UUID,
CreatedAt = paste.CreatedAt,
IsCompressed = paste.IsCompressed, IsCompressed = paste.IsCompressed,
Size = paste.Size, Size = paste.Size,
TrueSize = paste.TrueSize, TrueSize = paste.TrueSize,
@@ -92,6 +93,7 @@ namespace SharpbinV3.Server.Controllers
{ {
ID = paste.ID, ID = paste.ID,
UUID = paste.UUID, UUID = paste.UUID,
CreatedAt = paste.CreatedAt,
Title = paste.Title, Title = paste.Title,
Size = paste.Size, Size = paste.Size,
TrueSize = paste.TrueSize, TrueSize = paste.TrueSize,
@@ -183,13 +185,13 @@ namespace SharpbinV3.Server.Controllers
if (request.ExpiresAt.HasValue) if (request.ExpiresAt.HasValue)
paste.ExpiresAt = request.ExpiresAt.Value; paste.ExpiresAt = request.ExpiresAt.Value;
if (!await _pasteService.ValidateExpiresAt(paste.ExpiresAt)) if (!_pasteService.ValidateExpiresAt(paste.ExpiresAt))
return BadRequest(new { success = false, message = "Invalid expiration time." }); return BadRequest(new { success = false, message = "Invalid expiration time." });
if (!await _pasteService.ValidateVisibility(paste.Visibility)) if (!_pasteService.ValidateVisibility(paste.Visibility))
return BadRequest(new { success = false, message = "Invalid visibility level. Must be between 0 and 2." }); return BadRequest(new { success = false, message = "Invalid visibility level. Must be between 0 and 2." });
if (!await _pasteService.ValidateSyntax(paste.Syntax ?? "plaintext")) if (!_pasteService.ValidateSyntax(paste.Syntax ?? "plaintext"))
return BadRequest(new { success = false, message = "Invalid syntax." }); return BadRequest(new { success = false, message = "Invalid syntax." });
if (!await _pasteService.ValidateTitle(paste.Title ?? "")) if (!_pasteService.ValidateTitle(paste.Title ?? ""))
return BadRequest(new { success = false, message = $"Invalid title. Must be less than {_pasteSettings.MaxTitleLength} characters." }); return BadRequest(new { success = false, message = $"Invalid title. Must be less than {_pasteSettings.MaxTitleLength} characters." });
var newPaste = await _pasteService.Edit(paste); var newPaste = await _pasteService.Edit(paste);
@@ -201,6 +203,7 @@ namespace SharpbinV3.Server.Controllers
{ {
ID = newPaste.ID, ID = newPaste.ID,
UUID = newPaste.UUID, UUID = newPaste.UUID,
CreatedAt = newPaste.CreatedAt,
Title = newPaste.Title, Title = newPaste.Title,
Size = newPaste.Size, Size = newPaste.Size,
TrueSize = newPaste.TrueSize, TrueSize = newPaste.TrueSize,
@@ -386,6 +389,7 @@ namespace SharpbinV3.Server.Controllers
{ {
ID = p.ID, ID = p.ID,
UUID = p.UUID, UUID = p.UUID,
CreatedAt = p.CreatedAt,
Title = p.Title, Title = p.Title,
Size = p.Size, Size = p.Size,
TrueSize = p.TrueSize, TrueSize = p.TrueSize,
@@ -394,7 +398,16 @@ namespace SharpbinV3.Server.Controllers
Syntax = p.Syntax, Syntax = p.Syntax,
Visibility = p.Visibility, Visibility = p.Visibility,
ExpiresAt = p.ExpiresAt, ExpiresAt = p.ExpiresAt,
EditedAt = p.EditedAt EditedAt = p.EditedAt,
Author = p.User != null && p.User.Visibility == 0 ? new UserSimpleDto
{
UID = p.User.UID,
UUID = p.User.UUID,
Username = p.User.Username,
DisplayName = p.User.DisplayName,
Visibility = p.User.Visibility,
Roles = p.User.Roles
} : null
})); }));
} }
@@ -405,7 +418,7 @@ namespace SharpbinV3.Server.Controllers
{ {
return Ok(new PasteOptionsDto return Ok(new PasteOptionsDto
{ {
Syntaxes = _pasteSettings.ValidSyntaxLanguages, Syntaxes = [.. _pasteSettings.ValidSyntaxLanguages],
Visibilities = Visibilities =
[ [
new() { Value = 0, DisplayName = "Public" }, new() { Value = 0, DisplayName = "Public" },
@@ -60,6 +60,7 @@ namespace SharpbinV3.Server.Controllers
[EnableRateLimiting("Strict")] [EnableRateLimiting("Strict")]
public async Task<IActionResult> UpdateByUUID(Guid uuid, [FromBody] UpdateUserDto updatedUser) public async Task<IActionResult> UpdateByUUID(Guid uuid, [FromBody] UpdateUserDto updatedUser)
{ {
Console.WriteLine($"{ModelState.IsValid}");
if (!ModelState.IsValid) if (!ModelState.IsValid)
return BadRequest(ModelState); return BadRequest(ModelState);
@@ -360,6 +361,7 @@ namespace SharpbinV3.Server.Controllers
{ {
ID = p.ID, ID = p.ID,
UUID = p.UUID, UUID = p.UUID,
CreatedAt = p.CreatedAt,
Title = p.Title, Title = p.Title,
Syntax = p.Syntax, Syntax = p.Syntax,
Size = p.Size, Size = p.Size,
@@ -396,6 +398,7 @@ namespace SharpbinV3.Server.Controllers
UID = user.UID, UID = user.UID,
Username = user.Username, Username = user.Username,
UUID = user.UUID, UUID = user.UUID,
CreatedAt = user.CreatedAt,
DisplayName = user.DisplayName, DisplayName = user.DisplayName,
Email = user.Email, Email = user.Email,
LastLogin = user.LastLogin, LastLogin = user.LastLogin,
@@ -422,6 +425,7 @@ namespace SharpbinV3.Server.Controllers
UID = user.UID, UID = user.UID,
Username = user.Username, Username = user.Username,
UUID = user.UUID, UUID = user.UUID,
CreatedAt = user.CreatedAt,
DisplayName = user.DisplayName, DisplayName = user.DisplayName,
Roles = user.Roles, Roles = user.Roles,
Visibility = user.Visibility Visibility = user.Visibility
@@ -6,6 +6,7 @@ namespace SharpbinV3.Server.DTOs.Paste
{ {
public string ID { get; set; } = string.Empty; public string ID { get; set; } = string.Empty;
public Guid UUID { get; set; } public Guid UUID { get; set; }
public long CreatedAt { get; set; }
public string? Title { get; set; } public string? Title { get; set; }
public string? Syntax { get; set; } public string? Syntax { get; set; }
public long Size { get; set; } public long Size { get; set; }
@@ -23,6 +24,7 @@ namespace SharpbinV3.Server.DTOs.Paste
{ {
public string ID { get; set; } = string.Empty; public string ID { get; set; } = string.Empty;
public Guid UUID { get; set; } public Guid UUID { get; set; }
public long CreatedAt { get; set; }
public bool IsCompressed { get; set; } public bool IsCompressed { get; set; }
public long Size { get; set; } public long Size { get; set; }
public long TrueSize { get; set; } public long TrueSize { get; set; }
@@ -3,7 +3,7 @@ using System.Text.RegularExpressions;
namespace SharpbinV3.Server.DTOs namespace SharpbinV3.Server.DTOs
{ {
public partial class RegisterUserDto public partial class RegisterUserDto : IValidatableObject
{ {
[Required] [Required]
[StringLength(50, MinimumLength = 3)] [StringLength(50, MinimumLength = 3)]
@@ -18,7 +18,7 @@ namespace SharpbinV3.Server.DTOs
public string? DisplayName { get; set; } public string? DisplayName { get; set; }
public string? Token { get; set; } public string? Token { get; set; }
public IEnumerable<ValidationResult> Validate() public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{ {
var results = new List<ValidationResult>(); var results = new List<ValidationResult>();
if (!ValidateUsername().IsMatch(Username)) if (!ValidateUsername().IsMatch(Username))
+2 -2
View File
@@ -3,7 +3,7 @@ using System.Text.RegularExpressions;
namespace SharpbinV3.Server.DTOs namespace SharpbinV3.Server.DTOs
{ {
public partial class UpdateUserDto public partial class UpdateUserDto : IValidatableObject
{ {
public string? DisplayName { get; set; } public string? DisplayName { get; set; }
public string? Email { get; set; } public string? Email { get; set; }
@@ -11,7 +11,7 @@ namespace SharpbinV3.Server.DTOs
public int[]? Roles { get; set; } public int[]? Roles { get; set; }
public string? TotpCode { get; set; } public string? TotpCode { get; set; }
public IEnumerable<ValidationResult> Validate() public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{ {
var results = new List<ValidationResult>(); var results = new List<ValidationResult>();
if (DisplayName != null) if (DisplayName != null)
@@ -4,6 +4,7 @@ namespace SharpbinV3.Server.DTOs.User
{ {
public int? UID { get; set; } public int? UID { get; set; }
public Guid UUID { get; set; } public Guid UUID { get; set; }
public long CreatedAt { get; set; }
public string Username { get; set; } = string.Empty; public string Username { get; set; } = string.Empty;
public string? DisplayName { get; set; } public string? DisplayName { get; set; }
public int[] Roles { get; set; } = []; public int[] Roles { get; set; } = [];
+5 -1
View File
@@ -9,11 +9,15 @@ namespace SharpbinV3.Server.Data.Entities
[Index(nameof(AuthorUUID))] [Index(nameof(AuthorUUID))]
[Index(nameof(ExpiresAt))] [Index(nameof(ExpiresAt))]
[Index(nameof(Visibility))] [Index(nameof(Visibility))]
[Index(nameof(Syntax))]
[Index(nameof(Views))]
[Index(nameof(Size))]
public sealed class Paste public sealed class Paste
{ {
[Key] [Key]
public int PID { get; set; } public int PID { get; set; }
public required Guid UUID { get; set; } // uuid v7 includes timestamp, this counts as created at public required Guid UUID { get; set; }
public long CreatedAt { get; set; } = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
public required string ID { get; set; } public required string ID { get; set; }
public string? Title { get; set; } public string? Title { get; set; }
+2 -1
View File
@@ -9,7 +9,8 @@ namespace SharpbinV3.Server.Data.Entities
{ {
public int? UID { get; set; } public int? UID { get; set; }
[Key] [Key]
public required Guid UUID { get; set; } = Guid.CreateVersion7(); // uuid v7 includes timestamp public required Guid UUID { get; set; } = Guid.CreateVersion7();
public long CreatedAt { get; set; } = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
public required string Username { get; set; } public required string Username { get; set; }
public required string PasswordHash { get; set; } public required string PasswordHash { get; set; }
@@ -0,0 +1,356 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SharpbinV3.Server.Data;
#nullable disable
namespace SharpbinV3.Server.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260128093015_IndexSyntaxViewsSize")]
partial class IndexSyntaxViewsSize
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.1");
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Paste", b =>
{
b.Property<int>("PID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<Guid?>("AuthorUUID")
.HasColumnType("TEXT");
b.Property<byte[]>("Content")
.IsRequired()
.HasColumnType("BLOB");
b.Property<long?>("EditedAt")
.HasColumnType("INTEGER");
b.Property<long>("ExpiresAt")
.HasColumnType("INTEGER");
b.Property<string>("ID")
.HasColumnType("TEXT");
b.Property<bool>("IsCompressed")
.HasColumnType("INTEGER");
b.Property<long>("Size")
.HasColumnType("INTEGER");
b.Property<string>("Syntax")
.HasColumnType("TEXT");
b.Property<string>("Title")
.HasColumnType("TEXT");
b.Property<long>("TrueSize")
.HasColumnType("INTEGER");
b.Property<Guid>("UUID")
.HasColumnType("TEXT");
b.Property<int>("Views")
.HasColumnType("INTEGER");
b.Property<int>("Visibility")
.HasColumnType("INTEGER");
b.HasKey("PID");
b.HasIndex("AuthorUUID");
b.HasIndex("ExpiresAt");
b.HasIndex("ID")
.IsUnique();
b.HasIndex("PID")
.IsUnique();
b.HasIndex("Size");
b.HasIndex("Syntax");
b.HasIndex("UUID")
.IsUnique();
b.HasIndex("Views");
b.HasIndex("Visibility");
b.ToTable("Pastes");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.PasteView", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("PastePID")
.HasColumnType("INTEGER");
b.Property<long>("ViewedAt")
.HasColumnType("INTEGER");
b.Property<string>("ViewerHash")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("PastePID", "ViewerHash")
.IsUnique();
b.ToTable("PasteViews");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.RefreshToken", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("TEXT");
b.Property<DateTimeOffset>("ExpiresAt")
.HasColumnType("TEXT");
b.Property<string>("JwtId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ReplacedByToken")
.HasColumnType("TEXT");
b.Property<bool>("Revoked")
.HasColumnType("INTEGER");
b.Property<byte[]>("RowVersion")
.IsRequired()
.HasColumnType("BLOB");
b.Property<string>("TokenHash")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("Used")
.HasColumnType("INTEGER");
b.Property<Guid>("UserUUID")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TokenHash")
.IsUnique();
b.HasIndex("UserUUID");
b.ToTable("RefreshTokens");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Report", b =>
{
b.Property<int>("ReportID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("CreatedAt")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<int?>("PastePID")
.HasColumnType("INTEGER");
b.Property<Guid>("ReporterUUID")
.HasColumnType("TEXT");
b.Property<int>("Status")
.HasColumnType("INTEGER");
b.Property<int>("TargetType")
.HasColumnType("INTEGER");
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.Property<long?>("UpdatedAt")
.HasColumnType("INTEGER");
b.Property<Guid?>("UserUUID")
.HasColumnType("TEXT");
b.HasKey("ReportID");
b.HasIndex("PastePID");
b.HasIndex("ReportID")
.IsUnique();
b.HasIndex("ReporterUUID");
b.HasIndex("TargetType");
b.HasIndex("UserUUID");
b.ToTable("Reports");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.User", b =>
{
b.Property<Guid>("UUID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("DisplayName")
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasColumnType("TEXT");
b.Property<long?>("LastLogin")
.HasColumnType("INTEGER");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("TEXT");
b.PrimitiveCollection<string>("Roles")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("UID")
.HasColumnType("INTEGER");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Visibility")
.HasColumnType("INTEGER");
b.HasKey("UUID");
b.HasIndex("UID");
b.HasIndex("UUID")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.UserTotp", b =>
{
b.Property<Guid>("UserUUID")
.HasColumnType("TEXT");
b.Property<long>("CreatedAt")
.HasColumnType("INTEGER");
b.Property<byte[]>("EncryptedSecret")
.IsRequired()
.HasColumnType("BLOB");
b.HasKey("UserUUID");
b.ToTable("UserTotps");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Paste", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
.WithMany("Pastes")
.HasForeignKey("AuthorUUID")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.PasteView", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.Paste", "Paste")
.WithMany("PasteViews")
.HasForeignKey("PastePID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Paste");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.RefreshToken", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
.WithMany("RefreshTokens")
.HasForeignKey("UserUUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Report", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.Paste", "Paste")
.WithMany("Reports")
.HasForeignKey("PastePID")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
.WithMany("Reports")
.HasForeignKey("UserUUID")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Paste");
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.UserTotp", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
.WithOne("Totp")
.HasForeignKey("SharpbinV3.Server.Data.Entities.UserTotp", "UserUUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Paste", b =>
{
b.Navigation("PasteViews");
b.Navigation("Reports");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.User", b =>
{
b.Navigation("Pastes");
b.Navigation("RefreshTokens");
b.Navigation("Reports");
b.Navigation("Totp");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,45 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SharpbinV3.Server.Migrations
{
/// <inheritdoc />
public partial class IndexSyntaxViewsSize : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_Pastes_Size",
table: "Pastes",
column: "Size");
migrationBuilder.CreateIndex(
name: "IX_Pastes_Syntax",
table: "Pastes",
column: "Syntax");
migrationBuilder.CreateIndex(
name: "IX_Pastes_Views",
table: "Pastes",
column: "Views");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Pastes_Size",
table: "Pastes");
migrationBuilder.DropIndex(
name: "IX_Pastes_Syntax",
table: "Pastes");
migrationBuilder.DropIndex(
name: "IX_Pastes_Views",
table: "Pastes");
}
}
}
@@ -0,0 +1,359 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SharpbinV3.Server.Data;
#nullable disable
namespace SharpbinV3.Server.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260128093730_PasteCreatedAt")]
partial class PasteCreatedAt
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.1");
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Paste", b =>
{
b.Property<int>("PID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<Guid?>("AuthorUUID")
.HasColumnType("TEXT");
b.Property<byte[]>("Content")
.IsRequired()
.HasColumnType("BLOB");
b.Property<long>("CreatedAt")
.HasColumnType("INTEGER");
b.Property<long?>("EditedAt")
.HasColumnType("INTEGER");
b.Property<long>("ExpiresAt")
.HasColumnType("INTEGER");
b.Property<string>("ID")
.HasColumnType("TEXT");
b.Property<bool>("IsCompressed")
.HasColumnType("INTEGER");
b.Property<long>("Size")
.HasColumnType("INTEGER");
b.Property<string>("Syntax")
.HasColumnType("TEXT");
b.Property<string>("Title")
.HasColumnType("TEXT");
b.Property<long>("TrueSize")
.HasColumnType("INTEGER");
b.Property<Guid>("UUID")
.HasColumnType("TEXT");
b.Property<int>("Views")
.HasColumnType("INTEGER");
b.Property<int>("Visibility")
.HasColumnType("INTEGER");
b.HasKey("PID");
b.HasIndex("AuthorUUID");
b.HasIndex("ExpiresAt");
b.HasIndex("ID")
.IsUnique();
b.HasIndex("PID")
.IsUnique();
b.HasIndex("Size");
b.HasIndex("Syntax");
b.HasIndex("UUID")
.IsUnique();
b.HasIndex("Views");
b.HasIndex("Visibility");
b.ToTable("Pastes");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.PasteView", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("PastePID")
.HasColumnType("INTEGER");
b.Property<long>("ViewedAt")
.HasColumnType("INTEGER");
b.Property<string>("ViewerHash")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("PastePID", "ViewerHash")
.IsUnique();
b.ToTable("PasteViews");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.RefreshToken", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("TEXT");
b.Property<DateTimeOffset>("ExpiresAt")
.HasColumnType("TEXT");
b.Property<string>("JwtId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ReplacedByToken")
.HasColumnType("TEXT");
b.Property<bool>("Revoked")
.HasColumnType("INTEGER");
b.Property<byte[]>("RowVersion")
.IsRequired()
.HasColumnType("BLOB");
b.Property<string>("TokenHash")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("Used")
.HasColumnType("INTEGER");
b.Property<Guid>("UserUUID")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TokenHash")
.IsUnique();
b.HasIndex("UserUUID");
b.ToTable("RefreshTokens");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Report", b =>
{
b.Property<int>("ReportID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("CreatedAt")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<int?>("PastePID")
.HasColumnType("INTEGER");
b.Property<Guid>("ReporterUUID")
.HasColumnType("TEXT");
b.Property<int>("Status")
.HasColumnType("INTEGER");
b.Property<int>("TargetType")
.HasColumnType("INTEGER");
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.Property<long?>("UpdatedAt")
.HasColumnType("INTEGER");
b.Property<Guid?>("UserUUID")
.HasColumnType("TEXT");
b.HasKey("ReportID");
b.HasIndex("PastePID");
b.HasIndex("ReportID")
.IsUnique();
b.HasIndex("ReporterUUID");
b.HasIndex("TargetType");
b.HasIndex("UserUUID");
b.ToTable("Reports");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.User", b =>
{
b.Property<Guid>("UUID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("DisplayName")
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasColumnType("TEXT");
b.Property<long?>("LastLogin")
.HasColumnType("INTEGER");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("TEXT");
b.PrimitiveCollection<string>("Roles")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("UID")
.HasColumnType("INTEGER");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Visibility")
.HasColumnType("INTEGER");
b.HasKey("UUID");
b.HasIndex("UID");
b.HasIndex("UUID")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.UserTotp", b =>
{
b.Property<Guid>("UserUUID")
.HasColumnType("TEXT");
b.Property<long>("CreatedAt")
.HasColumnType("INTEGER");
b.Property<byte[]>("EncryptedSecret")
.IsRequired()
.HasColumnType("BLOB");
b.HasKey("UserUUID");
b.ToTable("UserTotps");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Paste", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
.WithMany("Pastes")
.HasForeignKey("AuthorUUID")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.PasteView", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.Paste", "Paste")
.WithMany("PasteViews")
.HasForeignKey("PastePID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Paste");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.RefreshToken", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
.WithMany("RefreshTokens")
.HasForeignKey("UserUUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Report", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.Paste", "Paste")
.WithMany("Reports")
.HasForeignKey("PastePID")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
.WithMany("Reports")
.HasForeignKey("UserUUID")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Paste");
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.UserTotp", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
.WithOne("Totp")
.HasForeignKey("SharpbinV3.Server.Data.Entities.UserTotp", "UserUUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Paste", b =>
{
b.Navigation("PasteViews");
b.Navigation("Reports");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.User", b =>
{
b.Navigation("Pastes");
b.Navigation("RefreshTokens");
b.Navigation("Reports");
b.Navigation("Totp");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SharpbinV3.Server.Migrations
{
/// <inheritdoc />
public partial class PasteCreatedAt : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "CreatedAt",
table: "Pastes",
type: "INTEGER",
nullable: false,
defaultValue: 0L);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CreatedAt",
table: "Pastes");
}
}
}
@@ -0,0 +1,362 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SharpbinV3.Server.Data;
#nullable disable
namespace SharpbinV3.Server.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260128101620_UserCreatedAt")]
partial class UserCreatedAt
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.1");
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Paste", b =>
{
b.Property<int>("PID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<Guid?>("AuthorUUID")
.HasColumnType("TEXT");
b.Property<byte[]>("Content")
.IsRequired()
.HasColumnType("BLOB");
b.Property<long>("CreatedAt")
.HasColumnType("INTEGER");
b.Property<long?>("EditedAt")
.HasColumnType("INTEGER");
b.Property<long>("ExpiresAt")
.HasColumnType("INTEGER");
b.Property<string>("ID")
.HasColumnType("TEXT");
b.Property<bool>("IsCompressed")
.HasColumnType("INTEGER");
b.Property<long>("Size")
.HasColumnType("INTEGER");
b.Property<string>("Syntax")
.HasColumnType("TEXT");
b.Property<string>("Title")
.HasColumnType("TEXT");
b.Property<long>("TrueSize")
.HasColumnType("INTEGER");
b.Property<Guid>("UUID")
.HasColumnType("TEXT");
b.Property<int>("Views")
.HasColumnType("INTEGER");
b.Property<int>("Visibility")
.HasColumnType("INTEGER");
b.HasKey("PID");
b.HasIndex("AuthorUUID");
b.HasIndex("ExpiresAt");
b.HasIndex("ID")
.IsUnique();
b.HasIndex("PID")
.IsUnique();
b.HasIndex("Size");
b.HasIndex("Syntax");
b.HasIndex("UUID")
.IsUnique();
b.HasIndex("Views");
b.HasIndex("Visibility");
b.ToTable("Pastes");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.PasteView", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("PastePID")
.HasColumnType("INTEGER");
b.Property<long>("ViewedAt")
.HasColumnType("INTEGER");
b.Property<string>("ViewerHash")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("PastePID", "ViewerHash")
.IsUnique();
b.ToTable("PasteViews");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.RefreshToken", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("TEXT");
b.Property<DateTimeOffset>("ExpiresAt")
.HasColumnType("TEXT");
b.Property<string>("JwtId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ReplacedByToken")
.HasColumnType("TEXT");
b.Property<bool>("Revoked")
.HasColumnType("INTEGER");
b.Property<byte[]>("RowVersion")
.IsRequired()
.HasColumnType("BLOB");
b.Property<string>("TokenHash")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("Used")
.HasColumnType("INTEGER");
b.Property<Guid>("UserUUID")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TokenHash")
.IsUnique();
b.HasIndex("UserUUID");
b.ToTable("RefreshTokens");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Report", b =>
{
b.Property<int>("ReportID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("CreatedAt")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<int?>("PastePID")
.HasColumnType("INTEGER");
b.Property<Guid>("ReporterUUID")
.HasColumnType("TEXT");
b.Property<int>("Status")
.HasColumnType("INTEGER");
b.Property<int>("TargetType")
.HasColumnType("INTEGER");
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.Property<long?>("UpdatedAt")
.HasColumnType("INTEGER");
b.Property<Guid?>("UserUUID")
.HasColumnType("TEXT");
b.HasKey("ReportID");
b.HasIndex("PastePID");
b.HasIndex("ReportID")
.IsUnique();
b.HasIndex("ReporterUUID");
b.HasIndex("TargetType");
b.HasIndex("UserUUID");
b.ToTable("Reports");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.User", b =>
{
b.Property<Guid>("UUID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<long>("CreatedAt")
.HasColumnType("INTEGER");
b.Property<string>("DisplayName")
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasColumnType("TEXT");
b.Property<long?>("LastLogin")
.HasColumnType("INTEGER");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("TEXT");
b.PrimitiveCollection<string>("Roles")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("UID")
.HasColumnType("INTEGER");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Visibility")
.HasColumnType("INTEGER");
b.HasKey("UUID");
b.HasIndex("UID");
b.HasIndex("UUID")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.UserTotp", b =>
{
b.Property<Guid>("UserUUID")
.HasColumnType("TEXT");
b.Property<long>("CreatedAt")
.HasColumnType("INTEGER");
b.Property<byte[]>("EncryptedSecret")
.IsRequired()
.HasColumnType("BLOB");
b.HasKey("UserUUID");
b.ToTable("UserTotps");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Paste", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
.WithMany("Pastes")
.HasForeignKey("AuthorUUID")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.PasteView", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.Paste", "Paste")
.WithMany("PasteViews")
.HasForeignKey("PastePID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Paste");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.RefreshToken", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
.WithMany("RefreshTokens")
.HasForeignKey("UserUUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Report", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.Paste", "Paste")
.WithMany("Reports")
.HasForeignKey("PastePID")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
.WithMany("Reports")
.HasForeignKey("UserUUID")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Paste");
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.UserTotp", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
.WithOne("Totp")
.HasForeignKey("SharpbinV3.Server.Data.Entities.UserTotp", "UserUUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Paste", b =>
{
b.Navigation("PasteViews");
b.Navigation("Reports");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.User", b =>
{
b.Navigation("Pastes");
b.Navigation("RefreshTokens");
b.Navigation("Reports");
b.Navigation("Totp");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SharpbinV3.Server.Migrations
{
/// <inheritdoc />
public partial class UserCreatedAt : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "CreatedAt",
table: "Users",
type: "INTEGER",
nullable: false,
defaultValue: 0L);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CreatedAt",
table: "Users");
}
}
}
@@ -30,6 +30,9 @@ namespace SharpbinV3.Server.Migrations
.IsRequired() .IsRequired()
.HasColumnType("BLOB"); .HasColumnType("BLOB");
b.Property<long>("CreatedAt")
.HasColumnType("INTEGER");
b.Property<long?>("EditedAt") b.Property<long?>("EditedAt")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
@@ -75,9 +78,15 @@ namespace SharpbinV3.Server.Migrations
b.HasIndex("PID") b.HasIndex("PID")
.IsUnique(); .IsUnique();
b.HasIndex("Size");
b.HasIndex("Syntax");
b.HasIndex("UUID") b.HasIndex("UUID")
.IsUnique(); .IsUnique();
b.HasIndex("Views");
b.HasIndex("Visibility"); b.HasIndex("Visibility");
b.ToTable("Pastes"); b.ToTable("Pastes");
@@ -210,6 +219,9 @@ namespace SharpbinV3.Server.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<long>("CreatedAt")
.HasColumnType("INTEGER");
b.Property<string>("DisplayName") b.Property<string>("DisplayName")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
+38
View File
@@ -164,6 +164,14 @@ namespace SharpbinV3.Server
}, cancellationToken: cancellationToken); }, cancellationToken: cancellationToken);
}; };
}); });
builder.Services.AddOutputCache(options =>
{
options.AddPolicy("1Day", builder =>
{
builder.Expire(TimeSpan.FromDays(1));
});
});
builder.Services.AddCors(o => builder.Services.AddCors(o =>
{ {
o.AddDefaultPolicy(p => o.AddDefaultPolicy(p =>
@@ -186,10 +194,13 @@ namespace SharpbinV3.Server
} }
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseCors();
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization(); app.UseAuthorization();
app.UseOutputCache();
app.MapControllers(); app.MapControllers();
using (var scope = app.Services.CreateScope()) using (var scope = app.Services.CreateScope())
@@ -213,6 +224,33 @@ namespace SharpbinV3.Server
app.MapHealthChecks("/health"); app.MapHealthChecks("/health");
app.MapGet("/api/stats", async (AppDbContext db) =>
{
var pasteCount = await db.Pastes.CountAsync();
var userCount = await db.Users.CountAsync();
var totalPasteSize = await db.Pastes.SumAsync(p => p.Size);
var pastSevenDays = DateTimeOffset.UtcNow.AddDays(-7).ToUnixTimeMilliseconds();
var pasteCountWeek = await db.Pastes.CountAsync(p => p.CreatedAt >= pastSevenDays);
return Results.Ok(new
{
success = true,
stats = new
{
pastes = new
{
total = pasteCount,
past7Days = pasteCountWeek,
totalSizeInBytes = totalPasteSize
},
users = new
{
total = userCount
},
}
});
}).CacheOutput(policy => policy.Expire(TimeSpan.FromDays(1)).Tag("stats"));
app.Run(); app.Run();
} }
static DirectoryInfo GetDataProtectionKeyDirectory(IHostEnvironment env) static DirectoryInfo GetDataProtectionKeyDirectory(IHostEnvironment env)
+7 -7
View File
@@ -53,13 +53,13 @@ namespace SharpbinV3.Server.Services
var totpEnabled = await _db.UserTotps.AnyAsync(t => t.UserUUID == user.UUID); var totpEnabled = await _db.UserTotps.AnyAsync(t => t.UserUUID == user.UUID);
var claims = new List<Claim> var claims = new List<Claim>
{ {
new("uuid", user.UUID.ToString()), new("uuid", user.UUID.ToString()),
new("username", user.Username), new("username", user.Username),
new("displayname", user.DisplayName ?? ""), new("displayname", user.DisplayName ?? ""),
new("totp_enabled", totpEnabled.ToString()), new("totp_enabled", totpEnabled.ToString()),
new(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()) new(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString())
}; };
if (user.Roles != null) if (user.Roles != null)
{ {
+140 -35
View File
@@ -1,20 +1,37 @@
using Microsoft.EntityFrameworkCore; using System.Text;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using SharpbinV3.Server.Data; using SharpbinV3.Server.Data;
using SharpbinV3.Server.Data.Entities; using SharpbinV3.Server.Data.Entities;
using SharpbinV3.Server.Extensions; using SharpbinV3.Server.Extensions;
using SharpbinV3.Server.Settings; using SharpbinV3.Server.Settings;
using System.Text;
namespace SharpbinV3.Server.Services namespace SharpbinV3.Server.Services
{ {
public sealed class PasteService(AppDbContext db, ICompressionService cs, IOptions<PasteSettings> options) public sealed class PasteService(
AppDbContext db,
ICompressionService cs,
IMemoryCache cache,
IOptions<PasteSettings> options
)
{ {
private readonly AppDbContext _db = db; private readonly AppDbContext _db = db;
private readonly ICompressionService _cs = cs; private readonly ICompressionService _cs = cs;
private readonly IMemoryCache _cache = cache;
private readonly PasteSettings _pasteSettings = options.Value; private readonly PasteSettings _pasteSettings = options.Value;
private readonly Lock _invalidationLock = new();
private readonly HashSet<string> _pasteListCacheKeys = [];
public async Task<Paste> Create(User? author, string content, string title, string syntax, int visibility, long expiresAt, bool shouldCompress) public async Task<Paste> Create(
User? author,
string content,
string title,
string syntax,
int visibility,
long expiresAt,
bool shouldCompress
)
{ {
var data = Encoding.UTF8.GetBytes(content); var data = Encoding.UTF8.GetBytes(content);
if (shouldCompress) if (shouldCompress)
@@ -42,6 +59,9 @@ namespace SharpbinV3.Server.Services
_db.Users.Update(author); _db.Users.Update(author);
} }
await _db.SaveChangesAsync(); await _db.SaveChangesAsync();
InvalidatePasteListCache();
return paste; return paste;
} }
@@ -49,22 +69,32 @@ namespace SharpbinV3.Server.Services
{ {
_db.Pastes.Remove(paste); _db.Pastes.Remove(paste);
var result = await _db.SaveChangesAsync(); var result = await _db.SaveChangesAsync();
InvalidatePasteCache(paste.ID);
return result > 0; return result > 0;
} }
public async Task<Paste> Edit(Paste paste) public async Task<Paste> Edit(Paste paste)
{ {
_db.Pastes.Update(paste); _db.Pastes.Update(paste);
await _db.SaveChangesAsync(); await _db.SaveChangesAsync();
InvalidatePasteCache(paste.ID);
return paste; return paste;
} }
public async Task<bool> Exists(string id) public async Task<bool> Exists(string id)
{ {
return await _db.Pastes.AnyAsync(p => p.ID == id); return await _db.Pastes.AnyAsync(p => p.ID == id);
} }
public async Task<bool> Exists(Guid uuid) public async Task<bool> Exists(Guid uuid)
{ {
return await _db.Pastes.AnyAsync(p => p.UUID == uuid); return await _db.Pastes.AnyAsync(p => p.UUID == uuid);
} }
public async Task<bool> EditText(Paste paste, string text) public async Task<bool> EditText(Paste paste, string text)
{ {
var data = Encoding.UTF8.GetBytes(text); var data = Encoding.UTF8.GetBytes(text);
@@ -78,13 +108,23 @@ namespace SharpbinV3.Server.Services
paste.IsCompressed = data.Length < Encoding.UTF8.GetByteCount(text); paste.IsCompressed = data.Length < Encoding.UTF8.GetByteCount(text);
_db.Pastes.Update(paste); _db.Pastes.Update(paste);
var result = await _db.SaveChangesAsync(); var result = await _db.SaveChangesAsync();
InvalidatePasteCache(paste.ID);
return result > 0; return result > 0;
} }
public async Task<(Paste? paste, bool alreadyExists)> RecordView(Paste paste, HttpContext context)
public async Task<(Paste? paste, bool alreadyExists)> RecordView(
Paste paste,
HttpContext context
)
{ {
if (paste == null) return (null, false); if (paste == null)
if (context == null) return (null, false); return (null, false);
if (_pasteSettings.View_HMAC_Secret == null) return (null, false); if (context == null)
return (null, false);
if (_pasteSettings.View_HMAC_Secret == null)
return (null, false);
var viewerIp = context.GetRequestIP(); var viewerIp = context.GetRequestIP();
var viewerUserAgent = context.Request.Headers.UserAgent.ToString(); var viewerUserAgent = context.Request.Headers.UserAgent.ToString();
@@ -92,60 +132,125 @@ namespace SharpbinV3.Server.Services
string viewerHash; string viewerHash;
if (viewerUser != null) if (viewerUser != null)
viewerHash = Utilities.ComputeHmacSha256(_pasteSettings.View_HMAC_Secret, viewerUser.UUID.ToString()); viewerHash = Utilities.ComputeHmacSha256(
_pasteSettings.View_HMAC_Secret,
viewerUser.UUID.ToString()
);
else else
viewerHash = Utilities.ComputeHmacSha256(_pasteSettings.View_HMAC_Secret, viewerIp + viewerUserAgent); viewerHash = Utilities.ComputeHmacSha256(
_pasteSettings.View_HMAC_Secret,
viewerIp + viewerUserAgent
);
if (await _db.PasteViews.AnyAsync(pv => pv.PastePID == paste.PID && pv.ViewerHash == viewerHash)) if (
await _db.PasteViews.AnyAsync(pv =>
pv.PastePID == paste.PID && pv.ViewerHash == viewerHash
)
)
return (null, true); return (null, true);
_db.PasteViews.Add(new PasteView _db.PasteViews.Add(
{ new PasteView
PastePID = paste.PID, {
ViewerHash = viewerHash, PastePID = paste.PID,
ViewedAt = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(), ViewerHash = viewerHash,
}); ViewedAt = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
}
);
paste.Views += 1; paste.Views += 1;
_db.Pastes.Update(paste); _db.Pastes.Update(paste);
var result = await _db.SaveChangesAsync(); var result = await _db.SaveChangesAsync();
if (result > 0)
InvalidatePasteCache(paste.ID);
return (result > 0 ? paste : null, result > 0); return (result > 0 ? paste : null, result > 0);
} }
public async Task<Paste?> Get(string id) public async Task<Paste?> Get(string id)
{ {
var paste = await _db.Pastes.Include(p => p.User).FirstOrDefaultAsync(p => p.ID == id); string key = $"v1:paste:{id}";
var paste = await _cache.GetOrCreateAsync(
key,
async entry =>
{
entry.SetSlidingExpiration(TimeSpan.FromMinutes(10));
return await _db
.Pastes.Include(p => p.User)
.FirstOrDefaultAsync(p => p.ID == id);
}
);
return paste ?? null; return paste ?? null;
} }
public async Task<List<Paste>> GetList(int offset, int count, bool publicOnly = false) public async Task<List<Paste>> GetList(int offset, int count, bool publicOnly = false)
{ {
var query = _db.Pastes.AsQueryable(); string key = $"v1:list:pastes:public={publicOnly}:offset={offset}:count={count}";
if (publicOnly)
query = query.Where(p => p.Visibility == 0);
return await query var pastes = await _cache.GetOrCreateAsync(
.OrderByDescending(p => p.PID) key,
.Skip(offset) async entry =>
.Take(count) {
.ToListAsync(); entry.SetSlidingExpiration(TimeSpan.FromMinutes(5));
lock (_invalidationLock)
_pasteListCacheKeys.Add(key);
var query = _db.Pastes.AsQueryable();
if (publicOnly)
query = query.Where(p => p.Visibility == 0);
return await query
.OrderByDescending(p => p.PID)
.Skip(offset)
.Take(count)
.Include(p => p.User)
.ToListAsync();
}
);
return pastes ?? [];
} }
public async Task<bool> ValidateSyntax(string syntax) public bool ValidateSyntax(string syntax)
{ {
return await Task.FromResult(_pasteSettings.ValidSyntaxLanguages.Contains(syntax)); return _pasteSettings.ValidSyntaxLanguages.Contains(syntax);
} }
public async Task<bool> ValidateTitle(string title)
public bool ValidateTitle(string title)
{ {
return await Task.FromResult(title.Length <= _pasteSettings.MaxTitleLength); return title.Length <= _pasteSettings.MaxTitleLength;
} }
public async Task<bool> ValidateVisibility(int visibility)
public bool ValidateVisibility(int visibility)
{ {
return await Task.FromResult(visibility >= 0 && visibility <= 2); return visibility >= 0 && visibility <= 2;
} }
public async Task<bool> ValidateExpiresAt(long expiresAt)
public bool ValidateExpiresAt(long expiresAt)
{ {
if (expiresAt == 0) return true; if (expiresAt == 0)
return true;
var currentTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); var currentTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
return await Task.FromResult(expiresAt > currentTime - 1000); return expiresAt > currentTime - 1000;
}
private void InvalidatePasteCache(string pasteId)
{
string key = $"v1:paste:{pasteId}";
_cache.Remove(key);
}
private void InvalidatePasteListCache()
{
lock (_invalidationLock)
{
foreach (var listKey in _pasteListCacheKeys)
_cache.Remove(listKey);
_pasteListCacheKeys.Clear();
}
} }
} }
} }
+1 -1
View File
@@ -4,7 +4,7 @@ namespace SharpbinV3.Server.Settings
{ {
public class PasteSettings public class PasteSettings
{ {
public string[] ValidSyntaxLanguages { get; set; } = []; public HashSet<string> ValidSyntaxLanguages { get; set; } = [];
public int MaxTitleLength { get; set; } = 500; public int MaxTitleLength { get; set; } = 500;
public int MaxPasteSizeInBytes { get; set; } = 1_048_576; // 1 MB public int MaxPasteSizeInBytes { get; set; } = 1_048_576; // 1 MB
public bool EnablePasteCompression { get; set; } = true; public bool EnablePasteCompression { get; set; } = true;
@@ -9,6 +9,7 @@
<EnableStaticWebAssets>false</EnableStaticWebAssets> <EnableStaticWebAssets>false</EnableStaticWebAssets>
<EnableDefaultContentItems>false</EnableDefaultContentItems> <EnableDefaultContentItems>false</EnableDefaultContentItems>
<AllowMissingPrunePackageData>True</AllowMissingPrunePackageData>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@@ -7,7 +7,8 @@
}, },
"AuthSettings": { "AuthSettings": {
"CF_Turnstile_SiteKey": "3x00000000000000000000FF", "CF_Turnstile_SiteKey": "3x00000000000000000000FF",
"CF_Turnstile_SecretKey": "1x0000000000000000000000000000000AA" "CF_Turnstile_SecretKey": "1x0000000000000000000000000000000AA",
"Admins_Require_2FA": false
}, },
"JwtSettings": { "JwtSettings": {
"Secret": "ad277c181e51d2131017abc53a5805ccb85410ab902d2e1e09266304e4e86d6c38f2b2543b708d678dfdbfb76016dcf568925ddb25dc91638a69e479e31a23c9", "Secret": "ad277c181e51d2131017abc53a5805ccb85410ab902d2e1e09266304e4e86d6c38f2b2543b708d678dfdbfb76016dcf568925ddb25dc91638a69e479e31a23c9",
+1
View File
@@ -46,6 +46,7 @@
"crystal", "crystal",
"csharp", "csharp",
"css", "css",
"csv",
"cue", "cue",
"d", "d",
"dart", "dart",