mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Add dependecies for hsqldb (#132)
* add dependecies for h2 db * Attempt to test h2 with docker-compose. * bump h2 to 2.0.202 * add dependecies for h2 db * use pgsql mode * switch to hsqldb * fix hibernate dialect Co-authored-by: FireMaskterK <20838718+FireMasterK@users.noreply.github.com>
This commit is contained in:
parent
dbb4a69bdd
commit
26814db8d9
5 changed files with 34 additions and 2 deletions
77
testing/api-test.sh
Executable file
77
testing/api-test.sh
Executable file
|
@ -0,0 +1,77 @@
|
|||
#!/bin/bash
|
||||
|
||||
CURLOPTS=(-i -s -S -o /dev/null -f -w "%{http_code}\tTime:\t%{time_starttransfer}\t%{url_effective}\n")
|
||||
HOST=127.0.0.1:8080
|
||||
|
||||
# Trending Page
|
||||
curl ${CURLOPTS[@]} $HOST/trending?region=US || exit 1
|
||||
|
||||
# Channel Pages
|
||||
curl ${CURLOPTS[@]} $HOST/channel/UCsXVk37bltHxD1rDPwtNM8Q || exit 1
|
||||
curl ${CURLOPTS[@]} $HOST/c/inanutshell || exit 1
|
||||
curl ${CURLOPTS[@]} $HOST/user/Kurzgesagt || exit 1
|
||||
|
||||
# Channel Nextpage
|
||||
CHANNEL_NEXTPAGE=$(curl -s -o - -f $HOST/channel/UCsXVk37bltHxD1rDPwtNM8Q | jq -r .nextpage)
|
||||
curl ${CURLOPTS[@]} $HOST/nextpage/channel/UCsXVk37bltHxD1rDPwtNM8Q -G --data-urlencode "nextpage=$CHANNEL_NEXTPAGE" || exit 1
|
||||
|
||||
# Playlist
|
||||
curl ${CURLOPTS[@]} $HOST/playlists/PLQSoWXSpjA3-egtFq45DcUydZ885W7MTT || exit 1
|
||||
|
||||
# Playlist Nextpage
|
||||
PLAYLIST_NEXTPAGE=$(curl -s -o - -f $HOST/playlists/PLQSoWXSpjA3-egtFq45DcUydZ885W7MTT | jq -r .nextpage)
|
||||
curl ${CURLOPTS[@]} $HOST/nextpage/playlists/UCsXVk37bltHxD1rDPwtNM8Q -G --data-urlencode "nextpage=$PLAYLIST_NEXTPAGE" || exit 1
|
||||
|
||||
# Streams
|
||||
curl ${CURLOPTS[@]} $HOST/streams/BtN-goy9VOY || exit 1
|
||||
|
||||
# Comments
|
||||
curl ${CURLOPTS[@]} $HOST/comments/BtN-goy9VOY || exit 1
|
||||
|
||||
# Comments Nextpage
|
||||
COMMENTS_NEXTPAGE=$(curl -s -o - -f $HOST/comments/BtN-goy9VOY | jq -r .nextpage)
|
||||
curl ${CURLOPTS[@]} $HOST/nextpage/comments/BtN-goy9VOY -G --data-urlencode "nextpage=$COMMENTS_NEXTPAGE" || exit 1
|
||||
|
||||
# Comments Repliespage
|
||||
COMMENTS_REPLIESPAGE=$(curl -s -o - -f $HOST/comments/BtN-goy9VOY | jq -r .comments[0].repliesPage)
|
||||
curl ${CURLOPTS[@]} $HOST/nextpage/comments/BtN-goy9VOY -G --data-urlencode "nextpage=$COMMENTS_REPLIESPAGE" || exit 1
|
||||
|
||||
# Comments Replies Nextpage
|
||||
COMMENTS_REPLIES_NEXTPAGE=$(curl -s -o - -f $HOST/nextpage/comments/BtN-goy9VOY -G --data-urlencode "nextpage=$COMMENTS_REPLIESPAGE" | jq -r .nextpage)
|
||||
curl ${CURLOPTS[@]} $HOST/nextpage/comments/BtN-goy9VOY -G --data-urlencode "nextpage=$COMMENTS_REPLIES_NEXTPAGE" || exit 1
|
||||
|
||||
USER=admin
|
||||
PASS=$(openssl rand -base64 12)
|
||||
|
||||
AUTH_REQ=$(jq -n --compact-output --arg username "$USER" --arg password "$PASS" '{"username": $username, "password": $password}')
|
||||
|
||||
# Register Account
|
||||
curl ${CURLOPTS[@]} $HOST/register -X POST -H "Content-Type: application/json" -d $AUTH_REQ || exit 1
|
||||
|
||||
# Login Account
|
||||
curl ${CURLOPTS[@]} $HOST/login -X POST -H "Content-Type: application/json" -d $AUTH_REQ || exit 1
|
||||
|
||||
AUTH_TOKEN=$(curl -s -o - -f $HOST/login -X POST -H "Content-Type: application/json" -d $AUTH_REQ | jq -r .token)
|
||||
|
||||
if [[ -z "$AUTH_TOKEN" || $AUTH_TOKEN == "null" ]]; then
|
||||
echo "Failed to get auth token"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check Subscription Status
|
||||
curl ${CURLOPTS[@]} $HOST/subscribed -G --data-urlencode "channelId=UCsXVk37bltHxD1rDPwtNM8Q" -H "Authorization: $AUTH_TOKEN" || exit 1
|
||||
|
||||
# Subscribe to a Channel
|
||||
curl ${CURLOPTS[@]} $HOST/subscribe -X POST -H "Content-Type: application/json" -H "Authorization: $AUTH_TOKEN" -d $(jq -n --compact-output --arg channelId "UCfdNM3NAhaBOXCafH7krzrA" '{"channelId": $channelId}') || exit 1
|
||||
|
||||
# Unsubscribe from the Channel
|
||||
curl ${CURLOPTS[@]} $HOST/unsubscribe -X POST -H "Content-Type: application/json" -H "Authorization: $AUTH_TOKEN" -d $(jq -n --compact-output --arg channelId "UCfdNM3NAhaBOXCafH7krzrA" '{"channelId": $channelId}') || exit 1
|
||||
|
||||
# Resubscribe to the Channel
|
||||
curl ${CURLOPTS[@]} $HOST/subscribe -X POST -H "Content-Type: application/json" -H "Authorization: $AUTH_TOKEN" -d $(jq -n --compact-output --arg channelId "UCfdNM3NAhaBOXCafH7krzrA" '{"channelId": $channelId}') || exit 1
|
||||
|
||||
# Wait 2s to allow the subscription request to be processed
|
||||
sleep 2
|
||||
|
||||
# Check Feed
|
||||
curl ${CURLOPTS[@]} $HOST/feed -G --data-urlencode "authToken=$AUTH_TOKEN" || exit 1
|
18
testing/config.hsqldb.properties
Normal file
18
testing/config.hsqldb.properties
Normal file
|
@ -0,0 +1,18 @@
|
|||
# The port to Listen on.
|
||||
PORT: 8080
|
||||
|
||||
# Proxy
|
||||
PROXY_PART: https://pipedproxy-ams.kavin.rocks
|
||||
|
||||
# Public API URL
|
||||
API_URL: https://pipedapi.kavin.rocks
|
||||
|
||||
# Public Frontend URL
|
||||
FRONTEND_URL: https://piped.kavin.rocks
|
||||
|
||||
# Hibernate properties
|
||||
hibernate.connection.url: jdbc:hsqldb:mem:memdb;sql.syntax_pgs=true
|
||||
hibernate.connection.driver_class: org.hsqldb.jdbcDriver
|
||||
hibernate.dialect: org.hibernate.dialect.HSQLDialect
|
||||
hibernate.connection.username: piped
|
||||
hibernate.connection.password: changeme
|
8
testing/docker-compose.hsqldb.yml
Normal file
8
testing/docker-compose.hsqldb.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
services:
|
||||
piped:
|
||||
image: 1337kavin/piped:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "127.0.0.1:8080:8080"
|
||||
volumes:
|
||||
- ./config.hsqldb.properties:/app/config.properties
|
Loading…
Add table
Add a link
Reference in a new issue