Commit Graph
42 Commits
Author SHA1 Message Date
whoswhip eb542342c9 Hot fixes, changed every single writeasjsonasync to writeasync cause it would bug some other stuff,fixed the authentication api which for some reason redirected to lost paste???? 2024-10-19 00:46:19 -04:00
whoswhip bdcc3a1dc6 Refactor for async operations and add new features
Updated Compression.cs to support asynchronous operations, including new methods for decompressing byte arrays and checking compression status.
Enhanced Logging.cs with asynchronous logging methods.
Refactored Program.cs to replace synchronous calls with asynchronous ones, added a new endpoint for editing pastes, and implemented rate limiting.
Removed outdated logging configuration.
2024-10-19 00:05:59 -04:00
whoswhip c28b9b92b1 merge 2024-10-18 20:45:31 -04:00
whoswhip 0d5fd3bc5d Extra checks and delete confirmation for pastes
## Copilot Generated Commit Details Below

Enhance auth and UI with notifications and delete confirmation

Enhanced authentication in Program.cs by adding checks for the
logged-in user and ensuring proper response handling. Improved
UI in paste.html and privatepaste.html by adding a confirmation
dialog for deletions and a notification system to inform users
of actions and errors. Added CSS styles to support these new
features with appropriate styling and animations.
2024-10-18 20:44:19 -04:00
whoswhip ab04010c30 Didnt mean to merge this! 2024-10-18 20:15:00 -04:00
whoswhip 49f8911be2 Merge files 2024-10-18 20:13:47 -04:00
whoswhip eb21e6d662 Pretty big update, this adds file compression on the server side to preserve space on the disk.
Switched the paste info displaying from server side to client side, which also added a new api to fetch the info.
A new api to check if the user is authorized, (/api/accounts/authenticated)

## Commit Message Details Below Generated by Copilot
Add compression, and install script

Added EncryptByteArray and DecryptByteArray methods to the Encryption class for handling byte array encryption and decryption.
Removed unused namespaces from Program.cs.
Replaced direct file content reading and HTML manipulation with database queries and JSON responses for better error handling and response consistency.
Added JSON error responses for various error conditions.
Implemented content compression and decompression using GZip in Compression.cs to reduce file size and improve performance.
Updated paste creation and retrieval logic to handle compressed and encrypted content.
Added new API endpoints for fetching paste information and checking user authentication status.
Modified HTML templates to dynamically fetch and display paste information and user authentication status using JavaScript.
Added Paste UID property to the Paste class to store unique identifiers for pastes.
Created a new Compression class to handle string compression and decompression using GZip.
Updated the InitializeAsync method to create the pastes.sqlite file if it does not exist.
Enhanced the user interface to show or hide elements based on user authentication status and paste ownership (client side).
Improved error handling and user feedback in the JavaScript code.
Added logic to handle compressed and encrypted content in various parts of the application.
Added a new Bash script (install.sh) to install Sharpbin on a Linux system, which includes fetching the latest release, extracting it, and configuring Cloudflare keys.
2024-10-18 20:12:48 -04:00
whoswhip 233b338f9b Fix Deletion Button Not Appearing
There was an extra space in the html for some reason around the area where its usually supposed to replace it with a variable server side. This commit fixes that issue.
2024-10-08 17:29:19 -04:00
whoswhip c6d1100ff0 Update README.md v1.0.0 2024-09-13 21:48:10 -04:00
whoswhip 44228ad099 Update README.md 2024-09-13 21:46:56 -04:00
whoswhip 914f7b7a73 Update README.md 2024-09-13 21:46:15 -04:00
whoswhip 65ddb4b722 Remove debug prints and refactor notification function
Removed unnecessary console output in Program.cs and Turnstile.cs to clean up logs and avoid exposing sensitive information. Refactored user.html to replace the `notification` function with `createNotification` for improved notification handling.
2024-09-13 11:54:04 -04:00
whoswhip 6ca6833b42 Merge branch 'master' of https://github.com/whoswhip/Sharpbin 2024-09-11 18:19:08 -04:00
whoswhip f816836b0f Add Cloudflare Turnstile integration and update UI titles
- Program.cs: Added static fields for Turnstile keys, updated login HTML, added token validation in login and sign-up endpoints, and updated configuration loading.
- admin.html, dash.html: Changed title to "dashboard".
- login.html, signup.html: Added Turnstile script and widget, updated form submission, and added styles/JS for token handling.
- user.html: Adjusted width of .pastes-wrapper.
- Turnstile.cs: Added Turnstile class with VerifyTurnstileToken method for token verification via Cloudflare API.
2024-09-11 18:18:58 -04:00
whoswhip b2090e9b4b Update README.md 2024-09-10 19:42:23 -04:00
whoswhip b2f5f34a06 Update README.md 2024-09-10 19:30:03 -04:00
whoswhip 2889921f12 Enhance rate limiting and mobile UI improvements for full mobile support!
Added new rate limiter policies "OneRequest" and "OneRequestPerIP" in `Program.cs`. Updated routing middleware and user authentication logic. Enhanced mobile navigation with a hamburger menu in multiple HTML files (`admin.html`, `user.html`, `archives.html`, `banned.html`, `error.html`, `login.html`, `paste.html`, `privatepaste.html`, `recent_pastes.html`). Introduced a notification system in `admin.html` and `login.html`. Updated CSS and JavaScript for better mobile responsiveness and user experience.
2024-09-10 19:29:21 -04:00
whoswhip 878cebacb6 Enhance null safety, UI, and SQL query handling
Improved null safety in `Program.cs` by using the null-conditional operator (`?.`) when accessing cookies. Modified SQL queries to exclude 'Unlisted' pastes and added checks to skip processing 'Private' or 'Unlisted' pastes. Adjusted the command to count total pastes to exclude 'Unlisted' pastes.

Updated `admin/user.html` to support multiple notifications, added functionality to copy the new password to the clipboard, and improved notification display and animation logic.

Removed a hardcoded paste link from `archives.html` which was for testing.

Enhanced `index.html` with a hamburger menu for mobile navigation, improved notification handling, and added CSS styles and media queries for better mobile support. Fixed minor formatting issues and improved code readability.
2024-09-09 21:41:06 -04:00
whoswhip 102bb57699 Deletion 2024-09-08 16:11:27 -04:00
whoswhip 560ad071ab Add private pastes, user bans, and UI enhancements
Enhanced Program.cs with response caching, compression, CORS policy, and private paste handling.
Refactored user ban logic and added expiration date handling.
Improved admin.html with localization and overflow handling.
Introduced PrivatePaste and Punishment classes.
Enhanced Paste and User classes for private pastes and punishments.
Updated initialization logic for punishedUsers table.
Ensured salts are written back to config.json if generated.
Enhanced user.html with ban/unban functionality and animations.
Improved archives.html, dash.html, and index.html with new UI elements and styles.
Added asynchronous content loading and notifications to paste.html.
Introduced Encryption.cs for AES encryption and decryption.
Created banned.html for displaying error messages.
Added privatepaste.html with dynamic content, password protection, and user interactions.
2024-09-08 16:07:59 -04:00
whoswhip 4791b32400 Change search input handler from search() to waitSearch()
Updated the `oninput` event handler in `admin.html` to call
`waitSearch()` instead of `search()`. This change likely
introduces a delay or debounce mechanism to enhance search
performance and user experience.
2024-09-07 18:59:51 -04:00
whoswhip 229e4a323e Merge branch 'master' of https://github.com/whoswhip/Sharpbin 2024-09-07 18:57:29 -04:00
whoswhip 071434efc9 Enhance security, add admin features, and improve UX
Removed unused cryptography directive and switched to BCrypt for hashing IPs and tokens with a configurable salt. Updated file paths for cross-platform compatibility. Added rate limiting to routes and new admin API endpoints for user management. Improved `config.json` handling and added random password generation.

Enhanced `admin.html` with search debounce, infinite scrolling, and updated CSS. Added password change functionality and notifications to `user.html`. Improved error handling in `archives.html` and refactored `index.html` for better readability. Corrected password character count in `signup.html`.
2024-09-07 18:57:18 -04:00
whoswhip ab8a8d43df Update README.md 2024-09-07 14:03:00 -04:00
whoswhip 8a06024d0b Update README.md 2024-09-07 14:01:13 -04:00
whoswhip f02e68b1d3 Enhance validation, logging, and UI/UX improvements
## COMMIT MESSAGE GENERATED BY COPILOT

Added JSON validation to multiple endpoints, ensuring valid JSON requests and improved error handling. Updated logging to use `DateTime.Now` and append to `logs.log` for specific actions. Enhanced `/api/accounts/login` with JSON validation and refactored for consistency.  Improved admin and user interfaces with search functionality, better date localization, and CSS adjustments. Enhanced error handling and feedback in `login.html` and `signup.html`, and improved search functionality in `archives.html`.
2024-09-07 13:59:33 -04:00
whoswhip 0e2aa78b5c Change Log 9/5/2024
- Search feature added to archives
2024-09-05 18:07:30 -04:00
whoswhip 1c73e8caa4 Improve title handling, token retrieval, and logging
## COMMIT MESSAGE GENERATED BY COPILOT

- Initialize and update `title` variable based on `paste.Title`.
- Update HTML template to use `{pastetitleattribute}` and `{pastetitle}`.
- Retrieve `token` from `Authorization` header or `token` cookie.
- Use `token` in `IsLoggedInAsync` and `GetLoggedInUserAsync` methods.
- Add logging for paste deletion, including log file and response.
- Update user type and UUID check in verification process.
- Log paste deletion details: timestamp, paste ID, user info, request.
2024-09-02 13:42:38 -04:00
whoswhip 05cb8f0afc User pages added 2024-08-27 14:13:51 -04:00
whoswhip bca02028d7 Merge branch 'master' of https://github.com/whoswhip/Sharpbin 2024-08-26 05:38:29 -04:00
whoswhip c3ac47171f Admin panel and punishments 2024-08-26 05:30:39 -04:00
whoswhip 317ae52826 Create README.md 2024-08-23 12:58:25 -04:00
whoswhip 3951fd3260 Create LICENSE 2024-08-23 12:51:05 -04:00
whoswhip 79276573bc Signup api, signup and login frontend 2024-08-23 12:26:41 -04:00
whoswhip 017abcfacc Account Creation, Logging, and API URI's changed 2024-08-23 09:49:03 -04:00
whoswhip 59fe4caa4d Commit Message Generated by Copilot
Enhance date handling, error checks, data limits, and rate limiting

- Added `using System.Globalization;` to support date and time formatting.
- Handled empty/null paste titles with defaults and truncation.
- Display paste dates as human-readable time differences.
- Changed rate limiting policy to "fixed-bigger".
- Improved error handling for `/api/create` endpoint.
- Updated `ConvertToBytes` method for clarity.
- Added `GetDifference` method for date comparisons.
- Enforced length limits on input fields in `index.html`.
2024-08-19 04:46:58 -04:00
whoswhip 47aed18919 Improvement to pastes archive, added navigator to the top of each page 2024-08-19 03:45:06 -04:00
whoswhip 7221d99b68 archive page has now been created 2024-08-19 00:35:09 -04:00
whoswhip cc7004d294 Remove unnecessary usings 2024-08-18 23:51:49 -04:00
whoswhip 3be5f90220 Last commit didnt add everything :( 2024-08-18 23:50:58 -04:00
whoswhip 2df77f3659 Error handling for paste pages for if it doesnt exist, visibility to pastes(not implemented yet), Recent pastes(all pastes coming soon except for unlisted/private ofc). 2024-08-18 23:49:47 -04:00
whoswhip d76331b01e Add project files. 2024-08-18 21:55:50 -04:00