diff --git a/build.gradle b/build.gradle index 7a88be3..1710a66 100644 --- a/build.gradle +++ b/build.gradle @@ -33,8 +33,8 @@ dependencies { implementation 'io.activej:activej-launchers-http:5.2' implementation 'org.hsqldb:hsqldb:2.6.1' implementation 'org.postgresql:postgresql:42.4.0' - implementation 'org.hibernate:hibernate-core:5.6.7.Final' - implementation 'org.hibernate:hibernate-hikaricp:5.6.7.Final' + implementation 'org.hibernate:hibernate-core:6.1.0.Final' + implementation 'org.hibernate:hibernate-hikaricp:6.1.0.Final' implementation 'com.zaxxer:HikariCP:5.0.1' implementation 'org.springframework.security:spring-security-crypto:5.7.1' implementation 'commons-logging:commons-logging:1.2' diff --git a/config.properties b/config.properties index fcf8f2c..d0ec253 100644 --- a/config.properties +++ b/config.properties @@ -1,37 +1,27 @@ # The port to Listen on. -PORT: 8080 - +PORT:8080 # The number of workers to use for the server -HTTP_WORKERS: 2 - +HTTP_WORKERS:2 # Proxy -PROXY_PART: https://pipedproxy-ams.kavin.rocks - +PROXY_PART:https://pipedproxy-ams.kavin.rocks # Outgoing HTTP Proxy - eg: 127.0.0.1:8118 #HTTP_PROXY: 127.0.0.1:8118 - # Captcha Parameters -CAPTCHA_BASE_URL: https://api.capmonster.cloud/ -CAPTCHA_API_KEY: INSERT_HERE - +CAPTCHA_BASE_URL:https://api.capmonster.cloud/ +CAPTCHA_API_KEY:INSERT_HERE # Public API URL -API_URL: https://pipedapi.kavin.rocks - +API_URL:https://pipedapi.kavin.rocks # Public Frontend URL -FRONTEND_URL: https://piped.kavin.rocks - +FRONTEND_URL:https://piped.kavin.rocks # Enable haveibeenpwned compromised password API -COMPROMISED_PASSWORD_CHECK: true - +COMPROMISED_PASSWORD_CHECK:true # Disable Registration -DISABLE_REGISTRATION: false - +DISABLE_REGISTRATION:false # Feed Retention Time in Days -FEED_RETENTION: 30 - +FEED_RETENTION:30 # Hibernate properties -hibernate.connection.url: jdbc:postgresql://postgres:5432/piped -hibernate.connection.driver_class: org.postgresql.Driver -hibernate.dialect: org.hibernate.dialect.PostgreSQL10Dialect -hibernate.connection.username: piped -hibernate.connection.password: changeme +hibernate.connection.url:jdbc:postgresql://postgres:5432/piped +hibernate.connection.driver_class:org.postgresql.Driver +hibernate.dialect:org.hibernate.dialect.PostgreSQLDialect +hibernate.connection.username:piped +hibernate.connection.password:changeme diff --git a/src/main/java/me/kavin/piped/Main.java b/src/main/java/me/kavin/piped/Main.java index d237130..e097ee6 100644 --- a/src/main/java/me/kavin/piped/Main.java +++ b/src/main/java/me/kavin/piped/Main.java @@ -1,6 +1,8 @@ package me.kavin.piped; 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.utils.DatabaseSessionFactory; 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.extractors.YoutubeStreamExtractor; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; import java.util.*; import java.util.concurrent.TimeUnit; diff --git a/src/main/java/me/kavin/piped/consts/Constants.java b/src/main/java/me/kavin/piped/consts/Constants.java index 40c5b84..23f6611 100644 --- a/src/main/java/me/kavin/piped/consts/Constants.java +++ b/src/main/java/me/kavin/piped/consts/Constants.java @@ -81,6 +81,13 @@ public class Constants { if (key.startsWith("hibernate")) 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() .followRedirects(true) .addInterceptor(BrotliInterceptor.INSTANCE); diff --git a/src/main/java/me/kavin/piped/utils/DatabaseHelper.java b/src/main/java/me/kavin/piped/utils/DatabaseHelper.java index c4eaa13..7564a05 100644 --- a/src/main/java/me/kavin/piped/utils/DatabaseHelper.java +++ b/src/main/java/me/kavin/piped/utils/DatabaseHelper.java @@ -1,13 +1,13 @@ 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 org.hibernate.FlushMode; 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.UUID; diff --git a/src/main/java/me/kavin/piped/utils/ResponseHelper.java b/src/main/java/me/kavin/piped/utils/ResponseHelper.java index ad2d46e..8225bfe 100644 --- a/src/main/java/me/kavin/piped/utils/ResponseHelper.java +++ b/src/main/java/me/kavin/piped/utils/ResponseHelper.java @@ -8,6 +8,10 @@ import com.rometools.rome.feed.synd.*; import com.rometools.rome.io.FeedException; import com.rometools.rome.io.SyndFeedOutput; 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.ipfs.IPFS; 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.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.util.*; import java.util.concurrent.TimeUnit; diff --git a/src/main/java/me/kavin/piped/utils/obj/db/Channel.java b/src/main/java/me/kavin/piped/utils/obj/db/Channel.java index a28a74b..9fe986b 100644 --- a/src/main/java/me/kavin/piped/utils/obj/db/Channel.java +++ b/src/main/java/me/kavin/piped/utils/obj/db/Channel.java @@ -1,10 +1,6 @@ package me.kavin.piped.utils.obj.db; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Index; -import javax.persistence.Table; +import jakarta.persistence.*; @Entity @Table(name = "channels", indexes = {@Index(columnList = "uploader_id", name = "channels_uploader_id_idx")}) diff --git a/src/main/java/me/kavin/piped/utils/obj/db/Playlist.java b/src/main/java/me/kavin/piped/utils/obj/db/Playlist.java index 71e6d77..129ac3d 100644 --- a/src/main/java/me/kavin/piped/utils/obj/db/Playlist.java +++ b/src/main/java/me/kavin/piped/utils/obj/db/Playlist.java @@ -1,8 +1,8 @@ package me.kavin.piped.utils.obj.db; import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import jakarta.persistence.*; -import javax.persistence.*; import java.util.List; import java.util.UUID; diff --git a/src/main/java/me/kavin/piped/utils/obj/db/PlaylistVideo.java b/src/main/java/me/kavin/piped/utils/obj/db/PlaylistVideo.java index 3579feb..c285d71 100644 --- a/src/main/java/me/kavin/piped/utils/obj/db/PlaylistVideo.java +++ b/src/main/java/me/kavin/piped/utils/obj/db/PlaylistVideo.java @@ -1,6 +1,6 @@ package me.kavin.piped.utils.obj.db; -import javax.persistence.*; +import jakarta.persistence.*; @Entity @Table(name = "playlist_videos", indexes = {@Index(columnList = "id", name = "playlist_videos_id_idx"), diff --git a/src/main/java/me/kavin/piped/utils/obj/db/PubSub.java b/src/main/java/me/kavin/piped/utils/obj/db/PubSub.java index 862f742..4ed8efe 100644 --- a/src/main/java/me/kavin/piped/utils/obj/db/PubSub.java +++ b/src/main/java/me/kavin/piped/utils/obj/db/PubSub.java @@ -1,14 +1,10 @@ package me.kavin.piped.utils.obj.db; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Index; -import javax.persistence.Table; +import jakarta.persistence.*; @Entity -@Table(name = "pubsub", indexes = { @Index(columnList = "id", name = "pubsub_id_idx"), - @Index(columnList = "subbed_at", name = "pubsub_subbed_at_idx") }) +@Table(name = "pubsub", indexes = {@Index(columnList = "id", name = "pubsub_id_idx"), + @Index(columnList = "subbed_at", name = "pubsub_subbed_at_idx")}) public class PubSub { @Id diff --git a/src/main/java/me/kavin/piped/utils/obj/db/User.java b/src/main/java/me/kavin/piped/utils/obj/db/User.java index a7f496e..e3ab042 100644 --- a/src/main/java/me/kavin/piped/utils/obj/db/User.java +++ b/src/main/java/me/kavin/piped/utils/obj/db/User.java @@ -1,6 +1,7 @@ package me.kavin.piped.utils.obj.db; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serializable; import java.util.Set; import java.util.UUID; diff --git a/src/main/java/me/kavin/piped/utils/obj/db/Video.java b/src/main/java/me/kavin/piped/utils/obj/db/Video.java index 5518ebc..49a87ce 100644 --- a/src/main/java/me/kavin/piped/utils/obj/db/Video.java +++ b/src/main/java/me/kavin/piped/utils/obj/db/Video.java @@ -1,11 +1,11 @@ package me.kavin.piped.utils.obj.db; -import javax.persistence.*; +import jakarta.persistence.*; @Entity -@Table(name = "videos", indexes = { @Index(columnList = "id", name = "videos_id_idx"), +@Table(name = "videos", indexes = {@Index(columnList = "id", name = "videos_id_idx"), @Index(columnList = "uploader_id", name = "video_uploader_id_idx"), - @Index(columnList = "uploaded", name = "video_uploaded_idx") }) + @Index(columnList = "uploaded", name = "video_uploaded_idx")}) public class Video { @Id diff --git a/testing/config.cockroachdb.properties b/testing/config.cockroachdb.properties index dcbd542..8073d67 100644 --- a/testing/config.cockroachdb.properties +++ b/testing/config.cockroachdb.properties @@ -1,18 +1,14 @@ # The port to Listen on. -PORT: 8080 - +PORT:8080 # Proxy -PROXY_PART: https://pipedproxy-ams.kavin.rocks - +PROXY_PART:https://pipedproxy-ams.kavin.rocks # Public API URL -API_URL: https://pipedapi.kavin.rocks - +API_URL:https://pipedapi.kavin.rocks # Public Frontend URL -FRONTEND_URL: https://piped.kavin.rocks - +FRONTEND_URL:https://piped.kavin.rocks # Hibernate properties -hibernate.connection.url: jdbc:postgresql://cockroachdb:26257/defaultdb?sslmode=disable -hibernate.connection.driver_class: org.postgresql.Driver -hibernate.dialect: org.hibernate.dialect.CockroachDB201Dialect -hibernate.connection.username: root -hibernate.connection.password: root +hibernate.connection.url:jdbc:postgresql://cockroachdb:26257/defaultdb?sslmode=disable +hibernate.connection.driver_class:org.postgresql.Driver +hibernate.dialect:org.hibernate.dialect.CockroachDialect +hibernate.connection.username:root +hibernate.connection.password:root