mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-04-19 11:11:18 +00:00

# Description of Changes Please provide a summary of the changes, including: - Enable user to add custom JAVA ops with env JAVA_CUSTOM_OPTS - Added support for prometheus (enabled via JAVA_CUSTOM_OPTS + enterprise license) - Changed settings from enterprise naming to 'Premium' - KeygenLicense Check to support offline licenses - Disable URL-to-PDF due to huge security bug - Remove loud Split PDF logs - addUsers renamed to adminSettings - Added Usage analytics page - Add user button to only be enabled based on total users free - Improve Merge memory usage Closes #(issue_number) --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing) for more details. --------- Co-authored-by: a <a> Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com> Co-authored-by: Connor Yoh <con.yoh13@gmail.com>
51 lines
2.1 KiB
Java
51 lines
2.1 KiB
Java
package stirling.software.SPDF.utils;
|
|
|
|
public class RequestUriUtils {
|
|
|
|
public static boolean isStaticResource(String requestURI) {
|
|
|
|
return isStaticResource("", requestURI);
|
|
}
|
|
|
|
public static boolean isStaticResource(String contextPath, String requestURI) {
|
|
|
|
return requestURI.startsWith(contextPath + "/css/")
|
|
|| requestURI.startsWith(contextPath + "/fonts/")
|
|
|| requestURI.startsWith(contextPath + "/js/")
|
|
|| requestURI.endsWith(contextPath + "robots.txt")
|
|
|| requestURI.startsWith(contextPath + "/images/")
|
|
|| requestURI.startsWith(contextPath + "/public/")
|
|
|| requestURI.startsWith(contextPath + "/pdfjs/")
|
|
|| requestURI.startsWith(contextPath + "/login")
|
|
|| requestURI.startsWith(contextPath + "/error")
|
|
|| requestURI.endsWith(".svg")
|
|
|| requestURI.endsWith(".png")
|
|
|| requestURI.endsWith(".ico")
|
|
|| requestURI.endsWith(".webmanifest")
|
|
|| requestURI.startsWith(contextPath + "/api/v1/info/status");
|
|
}
|
|
|
|
public static boolean isTrackableResource(String requestURI) {
|
|
return isTrackableResource("", requestURI);
|
|
}
|
|
|
|
public static boolean isTrackableResource(String contextPath, String requestURI) {
|
|
return !(requestURI.startsWith("/js")
|
|
|| requestURI.startsWith("/v1/api-docs")
|
|
|| requestURI.endsWith("robots.txt")
|
|
|| requestURI.startsWith("/images")
|
|
|| requestURI.endsWith(".png")
|
|
|| requestURI.endsWith(".ico")
|
|
|| requestURI.endsWith(".css")
|
|
|| requestURI.endsWith(".map")
|
|
|| requestURI.endsWith(".svg")
|
|
|| requestURI.endsWith("popularity.txt")
|
|
|| requestURI.endsWith(".js")
|
|
|| requestURI.contains("swagger")
|
|
|| requestURI.startsWith("/api/v1/info")
|
|
|| requestURI.startsWith("/site.webmanifest")
|
|
|| requestURI.startsWith("/fonts")
|
|
|| requestURI.startsWith("/pdfjs"));
|
|
}
|
|
}
|