Commit graph

20 commits

Author SHA1 Message Date
ef0c0a5e89
feat: ensure periodic data updates for app stability
Added instructions to README for regularly triggering `/cron/` to keep the app's cached data updated. Modified `main.py` to initialize `global_ibles` even when using a WSGI server, ensuring data consistency. This change improves the reliability and performance of the app by maintaining up-to-date data.

Relates to #9
2024-10-02 11:54:03 +02:00
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
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
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
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
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
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
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
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
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
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
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