Skip to content
Snippets Groups Projects
Commit 47ff2e0c authored by Kelvin's avatar Kelvin
Browse files

Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay

parents db7c0929 2bcd59cb
No related branches found
No related tags found
No related merge requests found
Showing
with 60 additions and 21 deletions
# Grayjay Core License 1.0
# Source First License 1.1
## Acceptance
By using the software, you agree to all of the terms and conditions below.
......@@ -16,7 +16,7 @@ Notwithstanding the above, you may not remove or obscure any functionality in th
You may not alter, remove, or obscure any licensing, copyright, or other notices of the Licensor in the software. Any use of the Licensor’s trademarks is subject to applicable law.
## Patents
If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
If you make any written claim that the software infringes or contributes to infringement of any patent, your license for the software granted under these terms ends immediately. If your company makes such a claim, your license ends immediately for work on behalf of your company.
## Notices
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms. If you modify the software, you must include in any modified copies of the software a prominent notice stating that you have modified the software, such as but not limited to, a statement in a readme file or an in-application about section.
......
......@@ -53,7 +53,8 @@ class StateSync {
private var _connectThread: Thread? = null
private var _started = false
private val _sessions: MutableMap<String, SyncSession> = mutableMapOf()
private val _lastConnectTimes: MutableMap<String, Long> = mutableMapOf()
private val _lastConnectTimesMdns: MutableMap<String, Long> = mutableMapOf()
private val _lastConnectTimesIp: MutableMap<String, Long> = mutableMapOf()
//TODO: Should sync mdns and casting mdns be merged?
//TODO: Decrease interval that devices are updated
//TODO: Send less data
......@@ -148,7 +149,21 @@ class StateSync {
for (connectPair in addressesToConnect) {
try {
val syncDeviceInfo = SyncDeviceInfo(connectPair.first, arrayOf(connectPair.second), PORT)
connect(syncDeviceInfo)
val now = System.currentTimeMillis()
val lastConnectTime = synchronized(_lastConnectTimesIp) {
_lastConnectTimesIp[connectPair.first] ?: 0
}
//Connect once every 30 seconds, max
if (now - lastConnectTime > 30000) {
synchronized(_lastConnectTimesIp) {
_lastConnectTimesIp[connectPair.first] = now
}
Logger.i(TAG, "Attempting to connect to authorized device by last known IP '${connectPair.first}' with pkey=${connectPair.first}")
connect(syncDeviceInfo)
}
} catch (e: Throwable) {
Logger.i(TAG, "Failed to connect to " + connectPair.first, e)
}
......@@ -222,14 +237,14 @@ class StateSync {
if (authorized && !isConnected(pkey)) {
val now = System.currentTimeMillis()
val lastConnectTime = synchronized(_lastConnectTimes) {
_lastConnectTimes[pkey] ?: 0
val lastConnectTime = synchronized(_lastConnectTimesMdns) {
_lastConnectTimesMdns[pkey] ?: 0
}
//Connect once every 30 seconds, max
if (now - lastConnectTime > 30000) {
synchronized(_lastConnectTimes) {
_lastConnectTimes[pkey] = now
synchronized(_lastConnectTimesMdns) {
_lastConnectTimesMdns[pkey] = now
}
Logger.i(TAG, "Found device authorized device '${name}' with pkey=$pkey, attempting to connect")
......@@ -237,7 +252,7 @@ class StateSync {
try {
connect(syncDeviceInfo)
} catch (e: Throwable) {
Logger.e(TAG, "Failed to connect to $pkey", e)
Logger.i(TAG, "Failed to connect to $pkey", e)
}
}
}
......
Subproject commit 31490e10f9ef661d6365c0cf4d0fcedf9d807a69
Subproject commit 5809463f3dc2fd81fb92740ede467e271b5ca0c3
Subproject commit 872bfa2d758317c4d0989d309966e85ceb4fcb29
Subproject commit 4309c58008b92bdf2905ef05bf9129b50eab1edd
Subproject commit 069aa3d31a35559e45c1fe1ea1eb2a94d3b5d120
Subproject commit 6dc9ba2b61ed885ec48e06e319ba75fe9bff942c
Subproject commit 4d554e93882d29542cb05d2956f4b2484d7df27f
Subproject commit b94d5a5091ae0929d82c703868616158607a4436
Subproject commit 35b56d380a9ae6ef85ba8ec16cecb0a86d4efa1d
Subproject commit 95ae01d5358328583fc3a3b59a2a0ca9d06301d2
Subproject commit 31490e10f9ef661d6365c0cf4d0fcedf9d807a69
Subproject commit 5809463f3dc2fd81fb92740ede467e271b5ca0c3
Subproject commit 872bfa2d758317c4d0989d309966e85ceb4fcb29
Subproject commit 4309c58008b92bdf2905ef05bf9129b50eab1edd
Subproject commit 069aa3d31a35559e45c1fe1ea1eb2a94d3b5d120
Subproject commit 6dc9ba2b61ed885ec48e06e319ba75fe9bff942c
Subproject commit 4d554e93882d29542cb05d2956f4b2484d7df27f
Subproject commit b94d5a5091ae0929d82c703868616158607a4436
Subproject commit dda3c6c71948be5e40b1704895eacf796753e953
Subproject commit 95ae01d5358328583fc3a3b59a2a0ca9d06301d2
Subproject commit a7063a300c40dd2310325716f2300ac9259f47aa
Subproject commit f7d58c6ca6de151c11bd4ecc48a7de81bdc36d8a
......@@ -15,7 +15,7 @@ touch $DOCUMENT_ROOT/maintenance.file
# Swap over the content
echo "Deploying content..."
cp ./app/build/outputs/bundle/playstoreRelease/app-playstore-release.aab $DOCUMENT_ROOT/app-playstore-release.aab
aws s3 cp ./app/build/outputs/bundle/playstoreRelease/app-playstore-release.aab s3://artifacts-grayjay-app/app-playstore-release.aab
# Notify Cloudflare to wipe the CDN cache
echo "Purging Cloudflare cache for zone $CLOUDFLARE_ZONE_ID..."
......
......@@ -27,6 +27,20 @@ echo $VERSION > $DOCUMENT_ROOT/version.txt
mkdir -p $DOCUMENT_ROOT/changelogs
git tag -l --format='%(contents)' $VERSION > $DOCUMENT_ROOT/changelogs/$VERSION
aws s3 cp ./app/build/outputs/apk/stable/release/app-stable-x86_64-release.apk s3://artifacts-grayjay-app/app-x86_64-release.apk
aws s3 cp ./app/build/outputs/apk/stable/release/app-stable-arm64-v8a-release.apk s3://artifacts-grayjay-app/app-arm64-v8a-release.apk
aws s3 cp ./app/build/outputs/apk/stable/release/app-stable-armeabi-v7a-release.apk s3://artifacts-grayjay-app/app-armeabi-v7a-release.apk
aws s3 cp ./app/build/outputs/apk/stable/release/app-stable-universal-release.apk s3://artifacts-grayjay-app/app-universal-release.apk
aws s3 cp ./app/build/outputs/apk/stable/release/app-stable-x86-release.apk s3://artifacts-grayjay-app/app-x86-release.apk
aws s3 cp ./app/build/outputs/apk/stable/release/app-stable-arm64-v8a-release.apk s3://artifacts-grayjay-app/app-release.apk
VERSION=$(git describe --tags)
echo $VERSION > ./version.txt
git tag -l --format='%(contents)' $VERSION > ./changelog.txt
aws s3 cp ./version.txt s3://artifacts-grayjay-app/version.txt
aws s3 cp ./changelog.txt s3://artifacts-grayjay-app/changelogs/$VERSION
# Notify Cloudflare to wipe the CDN cache
echo "Purging Cloudflare cache for zone $CLOUDFLARE_ZONE_ID..."
curl -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/purge_cache" \
......
......@@ -23,6 +23,16 @@ cp ./app/build/outputs/apk/unstable/release/app-unstable-x86-release.apk $DOCUME
cp ./app/build/outputs/apk/unstable/release/app-unstable-arm64-v8a-release.apk $DOCUMENT_ROOT/app-release-unstable.apk
git describe --tags > $DOCUMENT_ROOT/version-unstable.txt
aws s3 cp ./app/build/outputs/apk/unstable/release/app-unstable-x86_64-release.apk s3://artifacts-grayjay-app/app-x86_64-release-unstable.apk
aws s3 cp ./app/build/outputs/apk/unstable/release/app-unstable-arm64-v8a-release.apk s3://artifacts-grayjay-app/app-arm64-v8a-release-unstable.apk
aws s3 cp ./app/build/outputs/apk/unstable/release/app-unstable-armeabi-v7a-release.apk s3://artifacts-grayjay-app/app-armeabi-v7a-release-unstable.apk
aws s3 cp ./app/build/outputs/apk/unstable/release/app-unstable-universal-release.apk s3://artifacts-grayjay-app/app-universal-release-unstable.apk
aws s3 cp ./app/build/outputs/apk/unstable/release/app-unstable-x86-release.apk s3://artifacts-grayjay-app/app-x86-release-unstable.apk
aws s3 cp ./app/build/outputs/apk/unstable/release/app-unstable-arm64-v8a-release.apk s3://artifacts-grayjay-app/app-release-unstable.apk
git describe --tags > ./version-unstable.txt
aws s3 cp ./version-unstable.txt s3://artifacts-grayjay-app/version-unstable.txt
# Notify Cloudflare to wipe the CDN cache
echo "Purging Cloudflare cache for zone $CLOUDFLARE_ZONE_ID..."
curl -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/purge_cache" \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment