watermark stuff
This commit is contained in:
parent
c140052822
commit
5ea3bcc1dd
18 changed files with 65 additions and 46 deletions
|
@ -1,4 +1,5 @@
|
|||
package stirling.software.SPDF.config;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -20,56 +21,59 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
public class CleanUrlInterceptor implements HandlerInterceptor {
|
||||
|
||||
private static final List<String> ALLOWED_PARAMS = Arrays.asList("lang", "endpoint", "endpoints");
|
||||
|
||||
private static final List<String> ALLOWED_PARAMS = Arrays.asList("lang", "endpoint", "endpoints");
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
String queryString = request.getQueryString();
|
||||
if (queryString != null && !queryString.isEmpty()) {
|
||||
String requestURI = request.getRequestURI();
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
String queryString = request.getQueryString();
|
||||
if (queryString != null && !queryString.isEmpty()) {
|
||||
String requestURI = request.getRequestURI();
|
||||
Map<String, String> parameters = new HashMap<>();
|
||||
|
||||
Map<String, String> parameters = new HashMap<>();
|
||||
// Keep only the allowed parameters
|
||||
String[] queryParameters = queryString.split("&");
|
||||
for (String param : queryParameters) {
|
||||
String[] keyValue = param.split("=");
|
||||
if (keyValue.length != 2) {
|
||||
continue;
|
||||
}
|
||||
if (ALLOWED_PARAMS.contains(keyValue[0])) {
|
||||
parameters.put(keyValue[0], keyValue[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Keep only the allowed parameters
|
||||
String[] queryParameters = queryString.split("&");
|
||||
for (String param : queryParameters) {
|
||||
String[] keyValue = param.split("=");
|
||||
if (keyValue.length != 2) {
|
||||
continue;
|
||||
}
|
||||
if (ALLOWED_PARAMS.contains(keyValue[0])) {
|
||||
parameters.put(keyValue[0], keyValue[1]);
|
||||
}
|
||||
}
|
||||
// If there are any parameters that are not allowed
|
||||
if (parameters.size() != queryParameters.length) {
|
||||
// Construct new query string
|
||||
StringBuilder newQueryString = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry : parameters.entrySet()) {
|
||||
if (newQueryString.length() > 0) {
|
||||
newQueryString.append("&");
|
||||
}
|
||||
newQueryString.append(entry.getKey()).append("=").append(entry.getValue());
|
||||
}
|
||||
|
||||
// If there are any other query parameters besides the allowed ones
|
||||
if (parameters.size() > 0) {
|
||||
// Construct new query string
|
||||
StringBuilder newQueryString = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry : parameters.entrySet()) {
|
||||
if (newQueryString.length() > 0) {
|
||||
newQueryString.append("&");
|
||||
}
|
||||
newQueryString.append(entry.getKey()).append("=").append(entry.getValue());
|
||||
}
|
||||
// Redirect to the URL with only allowed query parameters
|
||||
String redirectUrl = requestURI + "?" + newQueryString;
|
||||
response.sendRedirect(redirectUrl);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Redirect to the URL with only allowed query parameters
|
||||
String redirectUrl = requestURI + "?" + newQueryString;
|
||||
response.sendRedirect(redirectUrl);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||
ModelAndView modelAndView) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
|
||||
}
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||
Exception ex) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ close=\u0625\u063A\u0644\u0627\u0642
|
|||
filesSelected = الملفات المحددة
|
||||
noFavourites = لم تتم إضافة أي مفضلات
|
||||
bored = الانتظار بالملل؟
|
||||
|
||||
alphabet=\u0627\u0644\u0623\u0628\u062C\u062F\u064A\u0629
|
||||
#############
|
||||
# HOME-PAGE #
|
||||
#############
|
||||
|
|
|
@ -20,6 +20,7 @@ close=Tanca
|
|||
filesSelected=fitxers seleccionats
|
||||
noFavourites=No s'ha afegit cap favorit
|
||||
bored=Avorrit esperant?
|
||||
alphabet=Alfabet
|
||||
#############
|
||||
# HOME-PAGE #
|
||||
#############
|
||||
|
|
|
@ -20,6 +20,7 @@ close=Schließen
|
|||
filesSelected=Dateien ausgewählt
|
||||
noFavourites=Keine Favoriten hinzugefügt
|
||||
bored=Gelangweiltes Warten?
|
||||
alphabet=Alphabet
|
||||
#############
|
||||
# HOME-PAGE #
|
||||
#############
|
||||
|
|
|
@ -20,6 +20,7 @@ close=Close
|
|||
filesSelected=files selected
|
||||
noFavourites=No favourites added
|
||||
bored=Bored Waiting?
|
||||
alphabet=Alphabet
|
||||
#############
|
||||
# HOME-PAGE #
|
||||
#############
|
||||
|
|
|
@ -20,6 +20,7 @@ close=Cerrar
|
|||
filesSelected=archivos seleccionados
|
||||
noFavourites=No se agregaron favoritos
|
||||
bored=¿Aburrido de esperar?
|
||||
alphabet=Alfabeto
|
||||
#############
|
||||
# HOME-PAGE #
|
||||
#############
|
||||
|
|
|
@ -20,6 +20,7 @@ close=Itxi
|
|||
filesSelected=Hautatutako fitxategiak
|
||||
noFavourites=Ez dira gogokoak gehitu
|
||||
bored=Itxaroten aspertuta?
|
||||
alphabet=Alfabetoa
|
||||
#############
|
||||
# HOME-PAGE #
|
||||
#############
|
||||
|
|
|
@ -24,6 +24,7 @@ close=Fermer
|
|||
filesSelected=fichiers sélectionnés
|
||||
noFavourites=Aucun favori ajouté
|
||||
bored=Ennuyé d'attendre ?
|
||||
alphabet=Alphabet
|
||||
#############
|
||||
# HOME-PAGE #
|
||||
#############
|
||||
|
|
|
@ -20,6 +20,7 @@ close=Chiudi
|
|||
filesSelected=file selezionati
|
||||
noFavourites=Nessun preferito
|
||||
bored=Stanco di aspettare?
|
||||
alphabet=Alfabeto
|
||||
#############
|
||||
# HOME-PAGE #
|
||||
#############
|
||||
|
|
|
@ -19,7 +19,8 @@ save=保存
|
|||
close=閉じる
|
||||
filesSelected=選択されたファイル
|
||||
noFavourites=お気に入りはありません
|
||||
bored=待ち時間が退屈?
|
||||
bored=å¾…ã<EFBFBD>¡æ™‚é–“ã<EFBFBD>Œé€€å±ˆï¼
|
||||
alphabet=\u30A2\u30EB\u30D5\u30A1\u30D9\u30C3\u30C8Ÿ
|
||||
#############
|
||||
# HOME-PAGE #
|
||||
#############
|
||||
|
|
|
@ -20,6 +20,7 @@ close=닫기
|
|||
filesSelected=개 파일 선택됨
|
||||
noFavourites=즐겨찾기 없음
|
||||
bored=기다리는 게 지루하신가요?
|
||||
alphabet=\uC54C\uD30C\uBCB3
|
||||
#############
|
||||
# HOME-PAGE #
|
||||
#############
|
||||
|
|
|
@ -20,6 +20,7 @@ close=Zamknij
|
|||
filesSelected=wybrane pliki
|
||||
noFavourites=Nie dodano ulubionych
|
||||
bored=Znudzony czekaniem?
|
||||
alphabet=Alfabet
|
||||
#############
|
||||
# HOME-PAGE #
|
||||
#############
|
||||
|
|
|
@ -20,6 +20,7 @@ close=Fechar
|
|||
filesSelected=arquivos selecionados
|
||||
noFavourites=Nenhum favorito adicionado
|
||||
bored=Entediado esperando?
|
||||
alphabet=Alfabeto
|
||||
#############
|
||||
# HOME-PAGE #
|
||||
#############
|
||||
|
|
|
@ -20,6 +20,7 @@ close=Închide
|
|||
filesSelected=fișiere selectate
|
||||
noFavourites=Niciun favorit adăugat
|
||||
bored=Plictisit așteptând?
|
||||
alphabet=Alfabet
|
||||
#############
|
||||
# HOME-PAGE #
|
||||
#############
|
||||
|
|
|
@ -20,6 +20,7 @@ close=Закрыть
|
|||
filesSelected=файлов выбрано
|
||||
noFavourites=Нет избранного
|
||||
bored=Скучно ждать?
|
||||
alphabet=\u0430\u043B\u0444\u0430\u0432\u0438\u0442
|
||||
#############
|
||||
# HOME-PAGE #
|
||||
#############
|
||||
|
|
|
@ -20,6 +20,7 @@ close=Stäng
|
|||
filesSelected=filer valda
|
||||
noFavourites=Inga favoriter har lagts till
|
||||
bored=Utråkad att vänta?
|
||||
alphabet=Alfabet
|
||||
#############
|
||||
# HEMSIDA #
|
||||
#############
|
||||
|
|
|
@ -20,6 +20,7 @@ close=关闭
|
|||
filesSelected=\u9009\u62E9\u7684\u6587\u4EF6
|
||||
noFavourites=\u6CA1\u6709\u6DFB\u52A0\u6536\u85CF\u5939
|
||||
bored=\u65E0\u804A\u7B49\u5F85\uFF1F
|
||||
alphabet=\u5B57\u6BCD\u8868
|
||||
#############
|
||||
# HOME-PAGE #
|
||||
#############
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="fontSize" th:text="#{alphabet}"></label>
|
||||
<label for="fontSize" th:text="#{alphabet} + ':'"></label>
|
||||
<select class="form-control" name="alphabet" id="alphabet-select">
|
||||
<option value="romain">Roman</option>
|
||||
<option value="arabic">العربية</option>
|
||||
|
|
Loading…
Reference in a new issue