mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Update to Hibernate 6.
This commit is contained in:
parent
047fd18f21
commit
c23805288f
13 changed files with 54 additions and 68 deletions
|
@ -33,8 +33,8 @@ dependencies {
|
||||||
implementation 'io.activej:activej-launchers-http:5.2'
|
implementation 'io.activej:activej-launchers-http:5.2'
|
||||||
implementation 'org.hsqldb:hsqldb:2.6.1'
|
implementation 'org.hsqldb:hsqldb:2.6.1'
|
||||||
implementation 'org.postgresql:postgresql:42.4.0'
|
implementation 'org.postgresql:postgresql:42.4.0'
|
||||||
implementation 'org.hibernate:hibernate-core:5.6.7.Final'
|
implementation 'org.hibernate:hibernate-core:6.1.0.Final'
|
||||||
implementation 'org.hibernate:hibernate-hikaricp:5.6.7.Final'
|
implementation 'org.hibernate:hibernate-hikaricp:6.1.0.Final'
|
||||||
implementation 'com.zaxxer:HikariCP:5.0.1'
|
implementation 'com.zaxxer:HikariCP:5.0.1'
|
||||||
implementation 'org.springframework.security:spring-security-crypto:5.7.1'
|
implementation 'org.springframework.security:spring-security-crypto:5.7.1'
|
||||||
implementation 'commons-logging:commons-logging:1.2'
|
implementation 'commons-logging:commons-logging:1.2'
|
||||||
|
|
|
@ -1,37 +1,27 @@
|
||||||
# The port to Listen on.
|
# The port to Listen on.
|
||||||
PORT:8080
|
PORT:8080
|
||||||
|
|
||||||
# The number of workers to use for the server
|
# The number of workers to use for the server
|
||||||
HTTP_WORKERS:2
|
HTTP_WORKERS:2
|
||||||
|
|
||||||
# Proxy
|
# Proxy
|
||||||
PROXY_PART:https://pipedproxy-ams.kavin.rocks
|
PROXY_PART:https://pipedproxy-ams.kavin.rocks
|
||||||
|
|
||||||
# Outgoing HTTP Proxy - eg: 127.0.0.1:8118
|
# Outgoing HTTP Proxy - eg: 127.0.0.1:8118
|
||||||
#HTTP_PROXY: 127.0.0.1:8118
|
#HTTP_PROXY: 127.0.0.1:8118
|
||||||
|
|
||||||
# Captcha Parameters
|
# Captcha Parameters
|
||||||
CAPTCHA_BASE_URL:https://api.capmonster.cloud/
|
CAPTCHA_BASE_URL:https://api.capmonster.cloud/
|
||||||
CAPTCHA_API_KEY:INSERT_HERE
|
CAPTCHA_API_KEY:INSERT_HERE
|
||||||
|
|
||||||
# Public API URL
|
# Public API URL
|
||||||
API_URL:https://pipedapi.kavin.rocks
|
API_URL:https://pipedapi.kavin.rocks
|
||||||
|
|
||||||
# Public Frontend URL
|
# Public Frontend URL
|
||||||
FRONTEND_URL:https://piped.kavin.rocks
|
FRONTEND_URL:https://piped.kavin.rocks
|
||||||
|
|
||||||
# Enable haveibeenpwned compromised password API
|
# Enable haveibeenpwned compromised password API
|
||||||
COMPROMISED_PASSWORD_CHECK:true
|
COMPROMISED_PASSWORD_CHECK:true
|
||||||
|
|
||||||
# Disable Registration
|
# Disable Registration
|
||||||
DISABLE_REGISTRATION:false
|
DISABLE_REGISTRATION:false
|
||||||
|
|
||||||
# Feed Retention Time in Days
|
# Feed Retention Time in Days
|
||||||
FEED_RETENTION:30
|
FEED_RETENTION:30
|
||||||
|
|
||||||
# Hibernate properties
|
# Hibernate properties
|
||||||
hibernate.connection.url:jdbc:postgresql://postgres:5432/piped
|
hibernate.connection.url:jdbc:postgresql://postgres:5432/piped
|
||||||
hibernate.connection.driver_class:org.postgresql.Driver
|
hibernate.connection.driver_class:org.postgresql.Driver
|
||||||
hibernate.dialect: org.hibernate.dialect.PostgreSQL10Dialect
|
hibernate.dialect:org.hibernate.dialect.PostgreSQLDialect
|
||||||
hibernate.connection.username:piped
|
hibernate.connection.username:piped
|
||||||
hibernate.connection.password:changeme
|
hibernate.connection.password:changeme
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package me.kavin.piped;
|
package me.kavin.piped;
|
||||||
|
|
||||||
import io.activej.inject.Injector;
|
import io.activej.inject.Injector;
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.CriteriaQuery;
|
||||||
import me.kavin.piped.consts.Constants;
|
import me.kavin.piped.consts.Constants;
|
||||||
import me.kavin.piped.utils.DatabaseSessionFactory;
|
import me.kavin.piped.utils.DatabaseSessionFactory;
|
||||||
import me.kavin.piped.utils.DownloaderImpl;
|
import me.kavin.piped.utils.DownloaderImpl;
|
||||||
|
@ -16,8 +18,6 @@ import org.schabi.newpipe.extractor.localization.Localization;
|
||||||
import org.schabi.newpipe.extractor.services.youtube.YoutubeThrottlingDecrypter;
|
import org.schabi.newpipe.extractor.services.youtube.YoutubeThrottlingDecrypter;
|
||||||
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor;
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor;
|
||||||
|
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,13 @@ public class Constants {
|
||||||
if (key.startsWith("hibernate"))
|
if (key.startsWith("hibernate"))
|
||||||
hibernateProperties.put(key, value);
|
hibernateProperties.put(key, value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// transform hibernate properties for legacy configureations
|
||||||
|
hibernateProperties.replace("hibernate.dialect",
|
||||||
|
"org.hibernate.dialect.PostgreSQL10Dialect",
|
||||||
|
"org.hibernate.dialect.PostgreSQLDialect"
|
||||||
|
);
|
||||||
|
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder()
|
OkHttpClient.Builder builder = new OkHttpClient.Builder()
|
||||||
.followRedirects(true)
|
.followRedirects(true)
|
||||||
.addInterceptor(BrotliInterceptor.INSTANCE);
|
.addInterceptor(BrotliInterceptor.INSTANCE);
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package me.kavin.piped.utils;
|
package me.kavin.piped.utils;
|
||||||
|
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.CriteriaQuery;
|
||||||
|
import jakarta.persistence.criteria.JoinType;
|
||||||
|
import jakarta.persistence.criteria.Root;
|
||||||
import me.kavin.piped.utils.obj.db.*;
|
import me.kavin.piped.utils.obj.db.*;
|
||||||
import org.hibernate.FlushMode;
|
import org.hibernate.FlushMode;
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
|
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
|
||||||
import javax.persistence.criteria.JoinType;
|
|
||||||
import javax.persistence.criteria.Root;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ import com.rometools.rome.feed.synd.*;
|
||||||
import com.rometools.rome.io.FeedException;
|
import com.rometools.rome.io.FeedException;
|
||||||
import com.rometools.rome.io.SyndFeedOutput;
|
import com.rometools.rome.io.SyndFeedOutput;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.CriteriaQuery;
|
||||||
|
import jakarta.persistence.criteria.JoinType;
|
||||||
|
import jakarta.persistence.criteria.Root;
|
||||||
import me.kavin.piped.consts.Constants;
|
import me.kavin.piped.consts.Constants;
|
||||||
import me.kavin.piped.ipfs.IPFS;
|
import me.kavin.piped.ipfs.IPFS;
|
||||||
import me.kavin.piped.utils.obj.*;
|
import me.kavin.piped.utils.obj.*;
|
||||||
|
@ -46,10 +50,6 @@ import org.schabi.newpipe.extractor.utils.JsonUtils;
|
||||||
import org.springframework.security.crypto.argon2.Argon2PasswordEncoder;
|
import org.springframework.security.crypto.argon2.Argon2PasswordEncoder;
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
|
||||||
import javax.persistence.criteria.JoinType;
|
|
||||||
import javax.persistence.criteria.Root;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
package me.kavin.piped.utils.obj.db;
|
package me.kavin.piped.utils.obj.db;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import jakarta.persistence.*;
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Index;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "channels", indexes = {@Index(columnList = "uploader_id", name = "channels_uploader_id_idx")})
|
@Table(name = "channels", indexes = {@Index(columnList = "uploader_id", name = "channels_uploader_id_idx")})
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package me.kavin.piped.utils.obj.db;
|
package me.kavin.piped.utils.obj.db;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package me.kavin.piped.utils.obj.db;
|
package me.kavin.piped.utils.obj.db;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "playlist_videos", indexes = {@Index(columnList = "id", name = "playlist_videos_id_idx"),
|
@Table(name = "playlist_videos", indexes = {@Index(columnList = "id", name = "playlist_videos_id_idx"),
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
package me.kavin.piped.utils.obj.db;
|
package me.kavin.piped.utils.obj.db;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import jakarta.persistence.*;
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Index;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "pubsub", indexes = {@Index(columnList = "id", name = "pubsub_id_idx"),
|
@Table(name = "pubsub", indexes = {@Index(columnList = "id", name = "pubsub_id_idx"),
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package me.kavin.piped.utils.obj.db;
|
package me.kavin.piped.utils.obj.db;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package me.kavin.piped.utils.obj.db;
|
package me.kavin.piped.utils.obj.db;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "videos", indexes = {@Index(columnList = "id", name = "videos_id_idx"),
|
@Table(name = "videos", indexes = {@Index(columnList = "id", name = "videos_id_idx"),
|
||||||
|
|
|
@ -1,18 +1,14 @@
|
||||||
# The port to Listen on.
|
# The port to Listen on.
|
||||||
PORT:8080
|
PORT:8080
|
||||||
|
|
||||||
# Proxy
|
# Proxy
|
||||||
PROXY_PART:https://pipedproxy-ams.kavin.rocks
|
PROXY_PART:https://pipedproxy-ams.kavin.rocks
|
||||||
|
|
||||||
# Public API URL
|
# Public API URL
|
||||||
API_URL:https://pipedapi.kavin.rocks
|
API_URL:https://pipedapi.kavin.rocks
|
||||||
|
|
||||||
# Public Frontend URL
|
# Public Frontend URL
|
||||||
FRONTEND_URL:https://piped.kavin.rocks
|
FRONTEND_URL:https://piped.kavin.rocks
|
||||||
|
|
||||||
# Hibernate properties
|
# Hibernate properties
|
||||||
hibernate.connection.url:jdbc:postgresql://cockroachdb:26257/defaultdb?sslmode=disable
|
hibernate.connection.url:jdbc:postgresql://cockroachdb:26257/defaultdb?sslmode=disable
|
||||||
hibernate.connection.driver_class:org.postgresql.Driver
|
hibernate.connection.driver_class:org.postgresql.Driver
|
||||||
hibernate.dialect: org.hibernate.dialect.CockroachDB201Dialect
|
hibernate.dialect:org.hibernate.dialect.CockroachDialect
|
||||||
hibernate.connection.username:root
|
hibernate.connection.username:root
|
||||||
hibernate.connection.password:root
|
hibernate.connection.password:root
|
||||||
|
|
Loading…
Reference in a new issue