API Proj
This commit is contained in:
parent
0f6b3101c6
commit
a2c1e11f56
29
API/.gitignore
vendored
Normal file
29
API/.gitignore
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
*.class
|
||||
*.log
|
||||
*.ctxt
|
||||
.mtj.tmp/
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
.idea
|
||||
cmake-build-*/
|
||||
.idea/**/mongoSettings.xml
|
||||
*.iws
|
||||
out/
|
||||
build/
|
||||
work/
|
||||
target/
|
||||
.idea_modules/
|
||||
atlassian-ide-plugin.xml
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
git.properties
|
||||
pom.xml.versionsBackup
|
2
API/README.md
Normal file
2
API/README.md
Normal file
@ -0,0 +1,2 @@
|
||||
# API
|
||||
The backend API for TextPurify, responsible for the filtering and moderation of text content. The API is built using Springboot, a modern Java web framework. The API can be accessed [here](https://purify.rainnny.club).
|
60
API/pom.xml
Normal file
60
API/pom.xml
Normal file
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<!-- Project Details -->
|
||||
<groupId>me.braydon</groupId>
|
||||
<artifactId>TextPurify-API</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<!-- Properties -->
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<!-- Build Config -->
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<!-- Spring -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-info</id>
|
||||
<goals>
|
||||
<goal>build-info</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<!-- Depends -->
|
||||
<dependencies>
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Libraries -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.32</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
36
API/src/main/java/me/braydon/profanity/TextPurifyAPI.java
Normal file
36
API/src/main/java/me/braydon/profanity/TextPurifyAPI.java
Normal file
@ -0,0 +1,36 @@
|
||||
package me.braydon.profanity;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Braydon
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@Log4j2(topic = "TextPurify")
|
||||
public class TextPurifyAPI {
|
||||
@SneakyThrows
|
||||
public static void main(@NonNull String[] args) {
|
||||
// Handle loading of our configuration file
|
||||
File config = new File("application.yml");
|
||||
if (!config.exists()) { // Saving the default config if it doesn't exist locally
|
||||
Files.copy(Objects.requireNonNull(TextPurifyAPI.class.getResourceAsStream("/application.yml")), config.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
log.info("Saved the default configuration to '{}', please re-launch the application", // Log the default config being saved
|
||||
config.getAbsolutePath()
|
||||
);
|
||||
return;
|
||||
}
|
||||
log.info("Found configuration at '{}'", config.getAbsolutePath()); // Log the found config
|
||||
|
||||
// Start the app
|
||||
SpringApplication.run(TextPurifyAPI.class, args);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package me.braydon.profanity.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* This service is responsible
|
||||
* for filtering text content.
|
||||
*
|
||||
* @author Braydon
|
||||
*/
|
||||
@Service
|
||||
public final class FiltrationService { }
|
@ -0,0 +1,12 @@
|
||||
package me.braydon.profanity.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* This service is responsible for moderating text
|
||||
* content and reporting it to the appropriate parties.
|
||||
*
|
||||
* @author Braydon
|
||||
*/
|
||||
@Service
|
||||
public final class ModerationService { }
|
19
API/src/main/resources/application.yml
Normal file
19
API/src/main/resources/application.yml
Normal file
@ -0,0 +1,19 @@
|
||||
# Server Configuration
|
||||
server:
|
||||
address: 0.0.0.0
|
||||
port: 7500
|
||||
|
||||
# Log Configuration
|
||||
logging:
|
||||
file:
|
||||
path: "./logs"
|
||||
|
||||
# Spring Configuration
|
||||
spring:
|
||||
# Don't serialize null values by default with Jackson
|
||||
jackson:
|
||||
default-property-inclusion: non_null
|
||||
|
||||
# Ignore
|
||||
banner:
|
||||
location: "classpath:banner.txt"
|
12
API/src/main/resources/banner.txt
Normal file
12
API/src/main/resources/banner.txt
Normal file
@ -0,0 +1,12 @@
|
||||
_______ _ _____ _ __ _____ _____
|
||||
|__ __| | | | __ \ (_)/ _| /\ | __ \_ _|
|
||||
| | _____ _| |_| |__) | _ _ __ _| |_ _ _ / \ | |__) || |
|
||||
| |/ _ \ \/ / __| ___/ | | | '__| | _| | | | / /\ \ | ___/ | |
|
||||
| | __/> <| |_| | | |_| | | | | | | |_| | / ____ \| | _| |_
|
||||
|_|\___/_/\_\\__|_| \__,_|_| |_|_| \__, | /_/ \_\_| |_____|
|
||||
__/ |
|
||||
|___/
|
||||
|
||||
| API Version - v${application.version}
|
||||
| Spring Version - ${spring-boot.formatted-version}
|
||||
____________________________________________________________________________
|
Loading…
x
Reference in New Issue
Block a user