2023-04-29 00:18:10 +02:00
|
|
|
package stirling.software.SPDF.controller.web;
|
|
|
|
|
2023-05-08 01:17:20 +02:00
|
|
|
import org.springframework.http.MediaType;
|
2023-04-29 00:18:10 +02:00
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.ui.Model;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
2023-05-08 01:17:20 +02:00
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
2023-04-29 00:18:10 +02:00
|
|
|
|
|
|
|
import io.swagger.v3.oas.annotations.Hidden;
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
public class GeneralWebController {
|
|
|
|
@GetMapping("/merge-pdfs")
|
|
|
|
@Hidden
|
|
|
|
public String mergePdfForm(Model model) {
|
|
|
|
model.addAttribute("currentPage", "merge-pdfs");
|
|
|
|
return "merge-pdfs";
|
|
|
|
}
|
2023-04-30 01:48:01 +02:00
|
|
|
@GetMapping("/about")
|
2023-04-29 23:26:16 +02:00
|
|
|
@Hidden
|
|
|
|
public String gameForm(Model model) {
|
2023-04-30 01:48:01 +02:00
|
|
|
model.addAttribute("currentPage", "about");
|
|
|
|
return "about";
|
2023-04-29 23:26:16 +02:00
|
|
|
}
|
|
|
|
|
2023-04-29 00:18:10 +02:00
|
|
|
@GetMapping("/multi-tool")
|
|
|
|
@Hidden
|
|
|
|
public String multiToolForm(Model model) {
|
|
|
|
model.addAttribute("currentPage", "multi-tool");
|
|
|
|
return "multi-tool";
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/")
|
|
|
|
public String home(Model model) {
|
|
|
|
model.addAttribute("currentPage", "home");
|
|
|
|
return "home";
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/home")
|
|
|
|
public String root(Model model) {
|
|
|
|
return "redirect:/";
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/remove-pages")
|
|
|
|
@Hidden
|
|
|
|
public String pageDeleter(Model model) {
|
|
|
|
model.addAttribute("currentPage", "remove-pages");
|
|
|
|
return "remove-pages";
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/pdf-organizer")
|
|
|
|
@Hidden
|
|
|
|
public String pageOrganizer(Model model) {
|
|
|
|
model.addAttribute("currentPage", "pdf-organizer");
|
|
|
|
return "pdf-organizer";
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/rotate-pdf")
|
|
|
|
@Hidden
|
|
|
|
public String rotatePdfForm(Model model) {
|
|
|
|
model.addAttribute("currentPage", "rotate-pdf");
|
|
|
|
return "rotate-pdf";
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/split-pdfs")
|
|
|
|
@Hidden
|
|
|
|
public String splitPdfForm(Model model) {
|
|
|
|
model.addAttribute("currentPage", "split-pdfs");
|
|
|
|
return "split-pdfs";
|
|
|
|
}
|
2023-05-02 23:59:16 +02:00
|
|
|
|
|
|
|
@GetMapping("/sign")
|
|
|
|
@Hidden
|
|
|
|
public String signForm(Model model) {
|
|
|
|
model.addAttribute("currentPage", "sign");
|
|
|
|
return "sign";
|
|
|
|
}
|
2023-05-08 01:17:20 +02:00
|
|
|
|
|
|
|
@GetMapping(value = "/robots.txt", produces = MediaType.TEXT_PLAIN_VALUE)
|
|
|
|
@ResponseBody
|
2023-05-08 16:26:41 +02:00
|
|
|
@Hidden
|
2023-05-08 01:17:20 +02:00
|
|
|
public String getRobotsTxt() {
|
2023-05-17 17:16:11 +02:00
|
|
|
String allowGoogleVisibility = System.getProperty("ALLOW_GOOGLE_VISIBILITY");
|
2023-05-08 01:17:20 +02:00
|
|
|
if (allowGoogleVisibility == null)
|
2023-05-17 17:16:11 +02:00
|
|
|
allowGoogleVisibility = System.getenv("ALLOW_GOOGLE_VISIBILITY");
|
2023-05-08 01:17:20 +02:00
|
|
|
if (allowGoogleVisibility == null)
|
2023-05-08 23:55:01 +02:00
|
|
|
allowGoogleVisibility = "false";
|
2023-05-08 01:17:20 +02:00
|
|
|
if (Boolean.parseBoolean(allowGoogleVisibility)) {
|
2023-05-08 23:55:01 +02:00
|
|
|
return "User-agent: Googlebot\nAllow: /\n\nUser-agent: *\nAllow: /";
|
2023-05-08 01:17:20 +02:00
|
|
|
} else {
|
|
|
|
return "User-agent: Googlebot\nDisallow: /\n\nUser-agent: *\nDisallow: /";
|
|
|
|
}
|
|
|
|
}
|
2023-05-02 23:59:16 +02:00
|
|
|
|
2023-04-29 00:18:10 +02:00
|
|
|
}
|