mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-15 16:20:03 +00:00
Final polishing steps
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package de.grimsi.gameyfin.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.servlet.resource.PathResourceResolver;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Configuration
|
||||
public class FrontendConfig implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/**")
|
||||
.addResourceLocations("classpath:/static/")
|
||||
.resourceChain(true)
|
||||
.addResolver(new PathResourceResolver() {
|
||||
@Override
|
||||
protected Resource getResource(@NonNull String resourcePath, @NonNull Resource location) throws IOException {
|
||||
Resource requestedResource = location.createRelative(resourcePath);
|
||||
return requestedResource.exists() && requestedResource.isReadable() ? requestedResource : new ClassPathResource("/static/index.html");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.authentication.HttpStatusEntryPoint;
|
||||
@@ -40,9 +42,9 @@ public class SecurityConfiguration {
|
||||
@Bean
|
||||
public InMemoryUserDetailsManager userDetailsService() {
|
||||
UserDetails user = User
|
||||
.withDefaultPasswordEncoder()
|
||||
.builder()
|
||||
.username(username)
|
||||
.password(password)
|
||||
.password("{noop}" + password) // FIXME: not very secure
|
||||
.authorities("ADMIN_API_ACCESS")
|
||||
.build();
|
||||
return new InMemoryUserDetailsManager(user);
|
||||
|
||||
@@ -8,8 +8,8 @@ gameyfin.password=
|
||||
# Root folder of your game library
|
||||
gameyfin.root=
|
||||
# Folders where gameyfin will store cached images and the database
|
||||
gameyfin.cache=${gameyfin.root}\.gameyfin\cache
|
||||
gameyfin.db=${gameyfin.root}\.gameyfin\db
|
||||
gameyfin.cache=${gameyfin.root}/.gameyfin/cache
|
||||
gameyfin.db=${gameyfin.root}/.gameyfin/db
|
||||
|
||||
# File extensions which gameyfin will recognize as game files
|
||||
gameyfin.file-extensions=iso, zip, rar, 7z, exe
|
||||
|
||||
Reference in New Issue
Block a user