Commit graph

53 commits

Author SHA1 Message Date
eb85c1c7fa
refactor: streamline imports and improve null checks
This commit makes several refinements across the main.py file for better readability and performance:
- Simplified the import statements by removing unused imports, such as `ConfigParser` and `stream_with_context`, and consolidating uses of `urllib.parse`.
- Enhanced code clarity by replacing `!= None` checks with the more Pythonic `is not None` for better readability and to adhere to PEP 8 recommendations.
- Omitted redundant variable assignments in functions where the variables were declared but not meaningfully used, focusing the logic and reducing memory usage slightly.
- Corrected a logical error in an if condition by ensuring a proper membership test with `"embedType" not in "file"` making the code not only more readable but also preventing potential bugs.

Together, these changes make the codebase leaner, more maintainable, and compliant with best practices.
2024-05-22 17:56:46 +02:00
455218f7b6
feat: stream proxy content dynamically
Refactored the proxy route to stream data dynamically from URLs starting
with specific domains, rather than loading it all at once. This change
introduces a subfunction within the proxy route handler to manage
streaming, which iterates through data chunks and yields them until
completion. The new approach aims to enhance performance and resource
utilization by avoiding the download of the entire content before
sending it to the client. Additionally, error handling has been
tightened, specifically for HTTP errors and missing 'content-type'
headers, improving the robustness and reliability of the proxy feature.
2024-03-29 08:17:56 +01:00
b517139b00
feat(main): track total project count in project
listing

Introduce a new variable to hold the total number of projects when
accessing the projects listing route. This addition enables improved
tracking and potential features that require knowing the total number of
projects upfront, such as pagination controls or statistics display.
This change only affects the `project_list` function when the path
matches the projects endpoint.

By having the total number of projects readily available, future
enhancements or adjustments to the UI/UX involving the display of
project quantities can be more easily implemented, offering a better
user experience.
2024-03-28 16:25:33 +01:00
a8c4ef5827
feat: support POST for search queries
Enhanced the search functionality to support POST requests, ensuring
more versatile and secure handling of search queries. This change
involves accepting search queries through both GET and POST methods,
aligning with best practices for handling potentially sensitive user
inputs. Additionally, refactored conditionals for improved readability
and maintainability of the code. This update aims at enhancing user
experience and security, paving the way for future improvements in how
user inputs are processed and handled within the application.
2024-03-28 16:22:59 +01:00
5a6d6d403c
feat: standardize navbar logo size
Introduced a specific height for the navbar logo across the application
to ensure consistency in the navbar's visual presentation. By adjusting
the CSS to set a fixed height and applying the corresponding class to
the logo in the header, the layout becomes more predictable and
harmonious, significantly improving the user interface's appearance.
2024-03-28 14:12:20 +01:00
5e99720328
Fix image embed check in file processing
Corrected the logic for identifying image files without an embedded type
by fixing the misplaced quotation marks in the conditional. This change
ensures that the correct files are appended with proxy URLs for step
images. Additionally, removed unnecessary whitespace for cleaner code
structure.
2024-02-16 18:31:38 +01:00
dfe7882b12
Consolidated matrix rooms and source links
Removed several Matrix chat room links from the README and streamlined
the list of instances to enhance readability and maintain a focus on
primary resources. Updated footer source code references to point to a
singular, official repository for increased clarity and to reflect the
project's centralization efforts. This change should make the
documentation less cluttered and more user-friendly for new
contributors.
2024-02-15 16:27:34 +01:00
bcdbf5ec69
Enhanced search integration
Refactored the project search function to dynamically construct query parameters, improving readability and maintainability. Introduced several new parameters to refine search results and included a timeout for reliability. Added logging for better debugging and transparency about the search operations.

Updated category and search routes to use the new search function capabilities, ensuring relevant results and proper exception handling. Additionally, implemented pagination support for better user experience when browsing projects.

To improve the UI, the category and project listing templates have been refreshed with a modern layout, including the use of Bootstrap classes and better organization of content.

Resolves issues with inefficient search parameter construction and user interface inconsistencies.
2024-01-31 19:22:58 +01:00
c1f4e157a4
Optimized navigation layout in header
Streamlined the header's HTML structure by consolidating navigation elements and search form into more efficient class usage, improving maintainability and readability. Removed fixed height for the logo to enhance flexibility in different resolutions. These adjustments make future styling and responsiveness optimizations smoother.
2024-01-31 17:36:47 +01:00
b730e9c6db
Center align media elements in article template
Improved visual consistency in 'article.html' by adding 'justify-content-center' to each media row, ensuring images, videos, and iframes are centered within their containers. Additionally, applied 'wrap' class to text content for enhanced readability. These changes cater to better user engagement and a more polished layout presentation.
2024-01-31 17:09:52 +01:00
9dd8f4e2e0
Enhanced environment configuration and content fetching
Extended environment variables to allow for greater configurability and aligned debug mode detection with the new STRUCTABLES_DEBUG variable. Additionally, introduced command-line arguments for specifying Invidious instance URLs and unsafe iframe display settings.

The content fetching logic has been revised for fetching JSON data directly instead of scraping HTML, resulting in a more robust and efficient data extraction process. New templates accommodate the change and present a cleaner UI, including handling of iframes, downloads, and proper proxying of external resources.

HTML templates have been refactored to utilize better layout and styling while enhancing support for iframes and downloads, complete with the new ability to block iframe content from outside sources unless explicitly permitted. This security-focused feature protects end-users from potentially unsafe content.
2024-01-31 12:50:19 +01:00
1a4e0360a2
Update Matrix room link in README
Corrected the Matrix room URL in the README documentation to point to the new `#structables:private.coffee` room. This ensures users can find and join the correct discussion channel.
2024-01-19 08:16:41 +01:00
9f117f5ccc
Improve text overflow handling in articles
Updated CSS to include word-wrapping rules and adjusted the article template to apply these styles to content rows, ensuring better handling of long strings without space characters and improving the readability of articles with unusual text content. No layout disruption expected.
2024-01-17 19:11:43 +01:00
6762004c50
Fix article template loop rendering issue
Corrected improper nesting within for-loop structure in the article template to ensure that step content is appropriately wrapped in a div, resolving visual inconsistencies in article step display. This change maintains structured and clean output for article content.
2024-01-17 18:46:20 +01:00
0249bccd9f
Update URL for Private.coffee's hosted instance
The README documentation has been updated to reflect the change in URL for the front-end alternative provided by Private.coffee. The updated link points to the new correct domain.
2024-01-17 18:30:24 +01:00
c8cb88e3b7
Rebrand project from Indestructables to Structables
Updated the project name and references across various files, including README, template headers, and footers to reflect the rebranding from 'Indestructables' to 'Structables'. The favicon has been removed, and the main logo updated to align with the new branding. The commit modifies links to the source code repository as part of rebranding efforts. This change creates a clear distinction from the upstream project while maintaining acknowledgments to the original sources.
2024-01-17 17:01:35 +01:00
232a1504fb
Update .gitignore and enhance project structure
- Add 'privacy.txt' to .gitignore to prevent checking it in
- Refactor data storage from arrays to dictionaries for better data handling in 'main.py'
- Include 'pathlib' import for handling filesystem paths
- Introduce new CSS and Bootstrap files providing updated styles and responsive design elements
- Modify HTML templates to use updated data structures and enhance accessibility

These changes improve code readability, maintain project consistency, and enhance the front-end presentation. This work is part of ongoing efforts to better manage project data, secure sensitive information, and provide a more robust user interface.
2024-01-17 16:43:51 +01:00
f60494af6e
Removed Selenium dependency from Indestructables
Enhanced the Indestructables fork by eliminating its reliance on Selenium and Playwright's Chromium binary. This change streamlines the setup process and potentially improves performance and stability. Additionally, a new matrix room link has been added to the README for community engagement. Related project licenses reiterated for clarity.
2024-01-16 17:18:47 +01:00
29592de90a
Refactor data fetching logic using stdlib
Removed dependencies on external libraries such as `requests`, `requests-html`, and `playwright` in favor of Python's standard libraries like `urllib` for HTTP requests and parsing functionality. A more robust and efficient data update function was introduced to scrape API keys and fetch project data using Typesense. Transitioned from a manual browser-based scraping approach to an API-based one for improved stability and performance. Added logging for better monitoring and debuggability. Error-handling now leverages `HTTPError` from `urllib.error`. Shifted the configuration of debug mode to rely on an environment variable, aligning with Twelve-Factor principles. Removed unused functions and streamlined the handling of various routes within the Flask app. This change shifts the project towards a more maintainable code base by using built-in libraries, reduces external dependencies, and improves resilience and scalability of the web scraping components.
2024-01-16 17:13:59 +01:00
d269a9992e Merge branch '3-so-there-s-another-upstream' into 'main'
License/Upstream link fixes

Closes #3

See merge request PrivateCoffee/indestructables!1
2023-07-19 06:28:04 +00:00
e09497f471
Improve error handling 2023-07-19 08:26:45 +02:00
9e6fa4501d
Add Destructables mention 2023-07-19 08:25:41 +02:00
9807d0fba5
Merge remote-tracking branch 'upstream/main'
Replace Font Awesome Pro icon with free version
2023-06-04 08:06:54 +02:00
snowcatridge10
2798786f51 update data on startup 2023-06-03 19:16:16 -04:00
snowcatridge10
ee274a7df7 Add privacy policy 2023-06-03 18:31:55 -04:00
snowcatridge10
e9b2928299 Add chromedrivermanager 2023-06-03 18:14:29 -04:00
snowcatridge10
499f0e9cbb add cronjob text file 2023-06-03 17:44:44 -04:00
snowcatridge10
3d1a1f6971 commit 2023-06-03 17:27:48 -04:00
063f4cc427
Merge remote-tracking branch 'upstream/main' 2023-06-03 23:04:34 +02:00
snowcatridge10
01622a6e9e oops 2023-06-03 12:38:20 -04:00
snowcatridge10
2fc73446b7 add instances link 2023-06-03 12:37:26 -04:00
snowcatridge10
bc18d42911 Add docker-compose 2023-06-03 11:42:49 -04:00
snowcatridge10
7ad40d8825 fix formating 2023-06-03 11:39:59 -04:00
snowcatridge10
fcecd19710 add docker 2023-06-03 11:36:06 -04:00
snowcatridge10
4fa9b1586b commit 2023-06-03 09:50:44 -04:00
75ec8b961f
Add cron endpoint to update global_ibles 2023-06-03 09:46:28 +02:00
fbb0fea2d5
Update upstream URL 2023-06-02 20:49:24 +02:00
01cccdeb20
Add Private.coffee instance to instance list 2023-06-02 20:48:39 +02:00
64bcc97e80
Shouldn't use internal URLs here, eh? 2023-06-02 15:38:48 +00:00
823a44f664
Replaced selenium with playwright
Fixed requirements
Added source links to footer
2023-06-02 14:02:40 +00:00
snowcatridge10
3b6d0984b1 add link to docs for running your own instance 2023-06-02 08:27:40 -04:00
snowcatridge10
86e9064bcb Add Website 2023-06-02 08:15:08 -04:00
snowcatridge10
f10143a126 change readme 2023-06-02 08:11:59 -04:00
snowcatridge10
cafb41ff75 fix badge 2023-06-02 08:04:14 -04:00
snowcatridge10
d8bfaf00df Add badge to matrix 2023-06-02 08:00:04 -04:00
snowcatridge10
586b916ed5 add new line 2023-06-01 19:25:13 -04:00
snowcatridge10
e836c82296 add matrix 2023-06-01 19:24:44 -04:00
snowcatridge10
b9a3f6e1af change wording 2023-06-01 17:32:42 -04:00
snowcatridge10
ca6919f039 add logo 2023-06-01 17:32:04 -04:00
snowcatridge10
eec84b2d06 Fix Markdown 2023-06-01 17:31:10 -04:00