Commit graph

98 commits

Author SHA1 Message Date
e845caff0e
fix(routes): correct handling of embed files
Enhanced logic for handling file embeds to ensure proper processing of
both downloadable and embedded files. Fixed issues related to condition
checks and image embedding. This improves reliability and correctness
when rendering different types of content attachments.

Fixes issue with inconsistent file embed handling.
2024-07-29 17:06:24 +02:00
20c03bb4e0
feat: update gitignore and pyproject.toml
All checks were successful
Docker CI/CD / Docker Build and Push to Docker Hub (push) Successful in 2m38s
Python Package CI/CD / Publish to PyPI (push) Successful in 1m10s
- .gitignore adjusted to handle Docker builds:
  - Added `/dist/*` to ignore all files in `dist/` except `css`.
- Increased library version to 0.3.10 in pyproject.toml.
- Removed unused bootstrap JS files.

This change ensures Docker builds exclude unnecessary files, while allowing necessary CSS files in `dist/`. Additionally, the version bump addresses new project improvements and the cleanup of orphaned files.
2024-07-21 17:12:09 +02:00
c82e0961b7
chore: update version to 0.3.9 and tweak .gitignore
All checks were successful
Docker CI/CD / Docker Build and Push to Docker Hub (push) Successful in 2m21s
Python Package CI/CD / Publish to PyPI (push) Successful in 1m7s
Bumped the project version to 0.3.9 in preparation for the next release. Adjusted .gitignore to properly ignore /dist/ directory. No major functionality changes expected.
2024-07-07 14:44:40 +02:00
cfb81fada1
feat: encode member usernames in URLs and add docstrings
All checks were successful
Docker CI/CD / Docker Build and Push to Docker Hub (push) Successful in 2m31s
Python Package CI/CD / Publish to PyPI (push) Successful in 1m9s
Added URL encoding for member usernames to prevent errors with special characters in profile and Instructables URLs. Improved code readability by including docstrings for route functions, and refined HTML templates to conditionally display member location only if it exists. Updated the project version to 0.3.8.
2024-07-01 15:27:23 +02:00
f576555005
feat(docker): add dev config and update prod image source
Introduce docker-compose-example-dev.yml for development environment, enabling local builds with stricter container settings (e.g., no-new-privileges, read-only).

Update docker-compose-example.yml to pull the latest version of the structables image from the registry instead of building it locally.

Ensures consistent deployment in production and better resource management during development.
2024-07-01 15:13:34 +02:00
7d81a65b2a
feat: add periodic background data update task
All checks were successful
Docker CI/CD / Docker Build and Push to Docker Hub (push) Successful in 2m34s
Python Package CI/CD / Publish to PyPI (push) Successful in 44s
Replaced the cron job for updating data with a background
thread that runs every 5 minutes within the Flask app. Updated
version to 0.3.7.

This change ensures data is refreshed regularly without
external dependencies like cron, improving deployment
simplicity and reliability.
2024-06-17 20:36:19 +02:00
556669d341
feat: add Docker CI/CD workflow for automated builds
Introduced a new Forgejo Actions workflow to automate the Docker image build and push process on tag creation. The workflow sets up the environment, including QEMU and Buildx, logs into Docker Hub, and pushes the built image. This improvement ensures consistent and efficient Docker image deployment.
2024-06-17 19:46:15 +02:00
98bc487d62
docs: update reverse proxy configuration path
Clarified the instruction for serving static files by specifying the exact path `structables/static` instead of the container's static directory. This aims to reduce confusion and ensure accurate configuration.
2024-06-17 19:12:59 +02:00
fc008032d3
docs: update README with Docker instructions and URL tweaks
Revised the URLs in the Instances section to be more concise by removing protocol prefixes. Added a new Production: Docker section to provide detailed instructions for running the application using Docker, enhancing deployment flexibility. Enhanced the Production section by renaming it to Production: Manual for clarity.

Addresses better readability and ease of use for setting up instances.
2024-06-17 19:10:38 +02:00
0f91a929d2
Merge pull request 'Add Docker' (#6) from vlnst/structables:docker into main
Reviewed-on: #6
2024-06-17 16:44:33 +00:00
2ca209042e
Add Docker support 2024-06-17 18:40:34 +03:00
923854c322
Add new instance structables.bloat.cat 2024-06-17 17:54:05 +03:00
cc450e10ff
feat: add markdown support for privacy policy
All checks were successful
Python Package CI/CD / Publish to PyPI (push) Successful in 39s
Introduced markdown rendering for the privacy policy alongside plain text support. This change enriches the presentation of the privacy policy by allowing markdown-formatted files. To facilitate this, the markdown2 library was added as a dependency, and the logic in the privacy policy route was adjusted to prioritize `.md` files over `.txt` when available. This update also includes a minor version bump and the addition of a markdown-related entry to `.gitignore`. These changes enhance the flexibility and user experience by supporting more visually structured privacy policies.

The removal of the default privacy file path (`privacy.txt`) from the environment configuration encourages explicit file path specification, accommodating the new markdown feature more seamlessly.
2024-06-08 20:07:58 +02:00
b2721c7de1
chore: bump structables version to 0.3.5
All checks were successful
Python Package CI/CD / Publish to PyPI (push) Successful in 37s
Incremented the project version in pyproject.toml to release new features and fixes. This version bump includes performance improvements and bug fixes that enhance the overall stability of the structables package.
2024-05-26 18:32:31 +02:00
6255587753
feat(privacy-policy): render HTML content safely
Some checks failed
Python Package CI/CD / Publish to PyPI (push) Failing after 36s
Updated the privacy policy template to render HTML content safely by applying the `safe` filter to the content variable. This change ensures that HTML content stored in the `content` variable is rendered correctly in the browser, without escaping HTML tags, enhancing the page's flexibility in displaying rich content. This approach assumes the content is pre-sanitized and safe to render, mitigating potential cross-site scripting (XSS) vulnerabilities.
2024-05-26 18:30:40 +02:00
9c8c9b6c17
feat: dynamic privacy policy loading
Enhanced the privacy policy display functionality to dynamically load content from a configurable file path. The path is specified via the `STRUCTABLES_PRIVACY_FILE` environment variable, allowing for greater flexibility and easier updates to the privacy policy without needing to redeploy the application. If the specified file is unreachable or the environment variable is unset, the system gracefully falls back to a default message, ensuring the site remains compliant with privacy policy disclosures under various circumstances. This change streamlines content management and improves the adaptability of the application to legal and policy requirements.
2024-05-26 18:28:38 +02:00
2d4df9bae1
feat: Add PyPI publishing workflow
Introduced a Forgejo Actions workflow for automatically publishing new versions to PyPI upon pushing tags. This enhancement automates the release process for Python packages, ensuring that tagged commits trigger a build and publish sequence in a controlled, containerized environment. The workflow includes steps for setting up the environment, installing dependencies, and securely uploading the package using stored PyPI tokens.

By automating the release pipeline, this change aims to reduce manual errors, streamline version releases, and support continuous delivery practices for Python projects.
2024-05-26 08:57:14 +02:00
e88058af35
chore: bump version to 0.3.4
Incremented the project version to 0.3.4 in pyproject.toml, preparing for a new release. This version bump reflects the latest minor fixes and improvements.
2024-05-26 08:51:11 +02:00
3812d675fc
feat: enhance file download handling
Improved the file download process by appending filenames to the proxy URLs, facilitating proper naming of downloaded files. Updated the proxy function to accept an optional filename parameter, which is then used to set the 'Content-Disposition' header for file downloads. This ensures that files downloaded through the proxy are saved with their original names, improving user experience and file management. Additionally, modified the main route to pass file names to the proxy URLs for both image and non-image files, aligning with the enhanced proxy functionality.

This change addresses user feedback regarding difficulties in identifying and organizing downloaded files, by ensuring files retain their names post-download, thus making it easier for users to recognize and manage their downloads effectively.
2024-05-26 08:50:22 +02:00
ef1566d20b
feat: bump structables version to 0.3.3
Increase the version of structables to 0.3.3 in preparation for a new release. This version bump reflects recent enhancements and bug fixes. It ensures users have access to the latest features and improvements in the structables package.
2024-05-25 17:21:54 +02:00
cbf596aee7
feat: revamp footer layout and improve section separation
Redesigned the footer in `footer.html` to use a light background with dark text, adopting a more modern aesthetic and enhancing readability. The layout now utilizes a responsive grid, separating content into two columns for better organization on wider screens.

In `index.html`, added conditional rendering of horizontal rules between sections, omitting the rule after the last section. This change improves visual flow and reduces unnecessary visual clutter on the page.

These changes collectively enhance the user interface's look and feel, aligning with modern web design practices and improving overall user experience.
2024-05-25 17:21:23 +02:00
75ae8ada4f
feat: Bump structables version to 0.3.2
Increased structables project version in pyproject.toml to reflect the latest updates and improvements added. This version increment is critical for package management and distribution, ensuring users receive the most recent features, bug fixes, and performance enhancements.
2024-05-25 17:10:50 +02:00
b320099c44
feat: enhance project search for teachers
Extended the `projects_search` function and adjusted `category_page` logic to specifically cater to searches initiated by teachers. This update introduces a `teachers` flag that, when set to true, modifies the search criteria to include projects tagged for teachers, thereby streamlining the retrieval of educational content. This change aims to improve the user experience for educators by making relevant projects more accessible.

By distinguishing teacher-initiated searches with a dedicated filter, the platform can now offer more tailored content, thus enhancing its value as an educational resource.
2024-05-25 17:10:19 +02:00
70e4b9ddee
chore: bump project version to 0.3.1
Incremented the project version in pyproject.toml to release minor fixes and improvements. This version update ensures users have access to the latest enhancements and bug fixes, maintaining the smooth and efficient operation of the Structables package.
2024-05-25 17:01:18 +02:00
6c22ddac8e
feat: Refactor app initialization for clarity
Refactored app initialization in `main.py` by encapsulating the Flask server start-up configuration into a `main` function. This change improves code readability and organization, making the execution flow clearer, especially when the application starts or is debugged. Previously, the server start-up logic was directly in the global scope guarded by `if __name__ == "__main__":`, making the logic slightly less organized. Moving this into a dedicated function allows for potential expansion and easier testing. Additionally, ensured data initialization occurs after server start-up to align with best practices for initial data loading.
2024-05-25 17:00:44 +02:00
bcc31368f9
docs: clarify project lineage in README
Revised the project description for Structables in the README to streamline the explanation of its ancestry. The adjustment clarifies that Structables is a fork of snowcatridge10's Indestructables, which in turn is a fork of Cobra's Destructables, making the project's lineage easier to understand without the prior mention of removing Selenium. This change aims to provide a clearer and more concise project background to new contributors and users.
2024-05-25 16:51:15 +02:00
bc9074fc2b
feat: implement dynamic content loading and config management
Introduce dynamic loading of project data and streamlined configuration management. This update modularizes the codebase, separating routes and utilities for improved maintainability and scalability. It also adds a new configuration system to manage environment variables more efficiently, ensuring a seamless setup process for different environments. The refactor includes the addition of Typesense API key retrieval for enhanced search capabilities and the initialization of the application with environment-specific settings, providing a foundation for further feature development and optimization.

The change underscores a shift towards a more maintainable and scalable architecture, setting the stage for future enhancements and features. By organizing the route and utility functions into separate modules, the codebase becomes easier to navigate and extend. The new config management approach centralizes settings, aiding in the smooth adaptation to varying deployment conditions. Additionally, the introduction of dynamic project data loading aims to keep the content fresh and relevant, improving the user experience.

This commit marks a significant step in the project's evolution, streamlining its structure and paving the way for continuous improvement and growth.
2024-05-25 16:48:15 +02:00
a014283775
feat: humanize project titles in listing
Convert slugged project head titles to readable format in the projects listing page by applying `unslugify` to the title before rendering. This enhances UI readability, making project titles more accessible and understandable to users. The change only affects how titles are displayed, with no impact on underlying data structures or URL schemes.
2024-05-25 15:42:40 +02:00
c60da5ec3a
feat: Enhance project channel search flexibility
Introduced `unslugify` function to expand search capabilities by generating possible original titles from slugs, allowing for a broader search when matching project channels. This function is utilized in the `project_list` method to attempt queries with different variants of a channel's name, enhancing the likelihood of matching user-desired content. The update optimizes search functionality and user experience by accommodating varied naming conventions.

Version incremented to 0.2.2 in project metadata to reflect new feature addition and improvements.
2024-05-25 15:14:27 +02:00
c593904a19
feat: Enhance error handling responses with correct status codes
Updated error handlers for 404, 400, 429, and 500 HTTP error responses to explicitly return the corresponding status codes along with the error templates. This change ensures that responses not only serve the correct error pages but also reflect the appropriate HTTP status codes, improving compliance with HTTP standards and enhancing the clarity of the server's response to clients.

This adjustment aids in proper error diagnostics and handling by both the client applications and search engines, potentially influencing SEO and user experience positively by ensuring that web crawlers correctly interpret the nature of the errors.

Resolves issues related to ambiguous HTTP status codes in error responses.
2024-05-25 15:04:26 +02:00
db9f4d9207
refactor(main): optimize server startup process
Moved `update_data()` to execute before entering the main conditional logic in the server startup process. This adjustment ensures that data initialization occurs immediately upon server start, outside of the main function's scope. The change eliminates redundant print statements and streamlines the startup sequence, potentially improving the startup time and overall server responsiveness from the moment it goes live. This modification leads to a cleaner and more efficient codebase, enhancing maintainability and readability.
2024-05-25 15:03:52 +02:00
6c5faf6c19
feat(main.py): Normalize external links for sitemap
To ensure consistency within our sitemap, we've introduced logic that normalizes external channel links to relative paths. This change detects links starting with "https://" and transforms them into relative paths by stripping the protocol and domain parts. This adjustment facilitates better integration with the site's navigation structure, eliminating potential issues with external link handling and improving the user experience when accessing these channels through the sitemap.
2024-05-25 14:57:52 +02:00
ee6cc2de6d
feat(sitemap): redesign UI for improved navigation
The sitemap page has undergone a significant redesign for enhanced user navigation. The update introduces a card-based layout with updated CSS for better visuals and user interaction, focusing on accessibility and aesthetics. The redesigned sitemap now features a containerized layout with cards, improving the overall page structure and readability. Each group within the sitemap is now displayed as a card, making individual sections more distinguishable and easier to navigate. This change aims to provide a more engaging user experience by making information easier to find and the page more pleasant to interact with.
2024-05-23 17:23:04 +02:00
d10381c687
feat: Update Matrix link and add issue-reporting guide
Updated the Matrix room link to ensure users are directed to the correct communication channel. Additionally introduced a new section on opening issues to guide users in reporting problems or providing feedback through the appropriate repositories and discussion forums. This enhancement aims to improve community engagement and streamline the feedback process.
2024-05-23 17:15:13 +02:00
de11b2843d
feat: bump version to 0.2.1, update .gitignore
Incremented the project version to 0.2.1, preparing for a new release with minor improvements and bug fixes. Additionally, refined the .gitignore file to explicitly include the distribution directory, ensuring build artifacts are not accidentally committed to version control. This step aligns with best practices for Python project maintenance and distribution.
2024-05-23 09:05:26 +02:00
0b4676b720
refactor: streamline README and enhance project visibility
Updated the project documentation and .gitignore for a cleaner structure and enhanced visibility. The README now integrates dynamic badges for real-time status like support links, PyPI version, and latest commit info, offering a quick overview of the project status at a glance. These changes aim to make the project more accessible to potential contributors and users by providing essential information more efficiently. Additionally, the `.gitignore` file has been updated to include the `dist/` directory, preventing the accidental inclusion of distribution files in the repository, thus maintaining a cleaner project structure.

The restructuring of the README content, including a simplified approach to setting up development and production environments, aligns with best practices, making it easier for new contributors to get started. Furthermore, the changes enhance project documentation coherence and readability by embedding relevant badges and updating linkage paths for better navigation.
2024-05-23 08:27:21 +02:00
85d5c88294
feat: Introduce pyproject.toml for build configuration
Migrated project dependencies and metadata into a newly added `pyproject.toml`, aligning with modern Python packaging practices. Removed `requirements.txt` as dependencies are now specified in the unified project configuration. Restructured the project by moving Python code, static assets, and templates into a `src/structables` directory to encapsulate project components better and facilitate packaging. Moreover, refactor `main.py` to read environment variables earlier, streamline argument parsing, and ensure configurations are correctly applied before the Flask app initialization. This reorganization supports better project scalability, simplifies the build process, and enhances maintainability by consolidating project configurations and dependencies.

Note: The usage of `pyproject.toml` requires tools that support PEP 518 and might necessitate updates to CI/CD pipelines or developer workflows.
2024-05-23 08:06:36 +02:00
25a07d797b
feat(article layout): Improve readability and multimedia integration
Revamped the article template to enhance visual appeal and user engagement. Introduced a modern, centered layout for article headers, enriched steps display, and standardized multimedia elements with rounded corners and shadows for a cohesive look. Adjustments ensure content is more engaging and accessible, encouraging longer visitor sessions and interaction. This change aligns with the goal of providing a more immersive user experience while maintaining the site's aesthetic consistency.

Refactored CSS to support these changes, defining variables for easier future theme adjustments and promoting code reuse across similar elements. The update signifies a pivotal shift towards a refined and flexible presentation of articles, potentially increasing visitor retention and satisfaction.
2024-05-23 07:30:45 +02:00
c32144d437
refactor: improve UI consistency across templates
Updated category and projects templates to enhance readability and maintain UI consistency. Both templates now use a card layout with image headers and a relocated author, channel information, and metrics (favorites, views) to the card footer for improved layout consistency and readability. Also standardized image and anchor tag formats across both pages, removing inline styles and deprecated classes for cleaner, more maintainable code. Changes aim to provide a more uniform user experience and simplify future template adjustments.
2024-05-22 18:21:40 +02:00
9eee296c81
feat(css): enhance card design with flex layout
Introduced a flexbox layout to cards for a more adaptive and cohesive structure. This update includes styling for `.card-body` and `.card-footer`, ensuring they occupy space efficiently and maintain visual consistency across different viewport sizes. The `.card-footer` now has a distinct background and top border to clearly delineate it from the body content, enhancing readability and aesthetic appeal.

This enhancement addresses the need for more flexible layout options within cards, improving the overall user experience by ensuring content is well-organized and visually appealing across devices.
2024-05-22 18:17:37 +02:00
b0adb37ce7
feat: Overhaul UI styling and structure
Introduced a modular CSS variable system for easier theme management, enhancing the maintainability and scalability of our site's design. Reorganized the HTML structure in the index page for a more semantic layout, improving accessibility and SEO. Additionally, updated the styling of UI components, such as navigation and cards, for a more modern and cohesive look. This change not only refreshes the website's aesthetics but also improves the user experience on both desktop and mobile devices.
2024-05-22 18:10:32 +02:00
d20f1d2e1b
refactor(footer): improve HTML structure and accessibility
Optimized the footer HTML markup for better readability and web accessibility. Changes include the use of more semantic HTML, such as replacing `<center>` tags with CSS for centering content, and ensuring proper use of self-closing `<hr />` tags. This update aims to enhance maintainability and ensure a more inclusive user experience by adhering to modern web standards.
2024-05-22 18:02:20 +02:00
0f9f8b21a4
refactor(header): streamline navigation and improve form aesthetics
Redesigned the header's navigation layout and search form to enhance user interface consistency and accessibility. Migrated the logo loading to utilize Flask's url_for, ensuring dynamic path resolution which is more maintainable and compatible across different deployment environments. Simplified the navbar structure by consolidating elements under a single navbar-collapse class, aligning with Bootstrap's best practices for responsive design. Upgraded the search button to be more visually appealing and accessible by replacing visibility styles with an outline class, promoting a clearer call-to-action for users to engage with the search functionality.
2024-05-22 18:01:09 +02:00
6324579b36
refactor: improve HTML formatting in base template
Adjusted the formatting in the base.html template for better readability and consistency. This includes changes to indentation, the self-closing of meta tags, and the simplification of the main block. These adjustments make the code cleaner and more in line with modern HTML practices, potentially easing future maintenance and readability.
2024-05-22 18:00:33 +02:00
83ed63b13f
feat: enhance accessibility and SEO on the base template
Improved the base template by setting the default language to English, enhancing SEO through better ordering of meta and title tags, and including an initial-scale for the viewport meta tag. Wrapped the main content area with a `<main>` tag to improve semantic HTML structure and accessibility. These changes make the site more accessible and potentially improve search engine rankings.
2024-05-22 17:57:14 +02:00
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