aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/Main.hx
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2025-03-25 03:02:03 +0300
committerRblSb <msrblsb@gmail.com>2025-03-25 08:16:04 +0300
commitf874dcd3de368e7e512ab1c0defdd17bc3026ce5 (patch)
tree74fecdf08577f2fc03b09b1170b9ffea9163af04 /src/client/Main.hx
parent8ee20a84cb35968f9247028a6a2daa57f04e90bb (diff)
Initial cache support for raw videos
m3u8 videos are cached without downloading segments, only m3u8 file is downloaded and segment links are updated to use synctube proxy, so you can add video to playlist as server, ignoring ip restrictions, and stream it to everyone
Diffstat (limited to 'src/client/Main.hx')
-rw-r--r--src/client/Main.hx23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/client/Main.hx b/src/client/Main.hx
index e7f8f30..abc39f6 100644
--- a/src/client/Main.hx
+++ b/src/client/Main.hx
@@ -27,7 +27,7 @@ import js.html.WebSocket;
class Main {
public static var instance(default, null):Main;
- static inline var SETTINGS_VERSION = 5;
+ static inline var SETTINGS_VERSION = 6;
static inline var MAX_CHAT_MESSAGES = 200;
public final settings:ClientSettings;
@@ -81,8 +81,6 @@ class Main {
uuid: null,
name: "",
hash: "",
- isExtendedPlayer: false,
- playerSize: 1,
chatSize: 300,
synchThreshold: 2,
isSwapped: false,
@@ -92,6 +90,7 @@ class Main {
hotkeysEnabled: true,
showHintList: true,
checkboxes: [],
+ checkedCache: [],
}
Settings.init(defaults, settingsPatcher);
settings = Settings.read();
@@ -139,6 +138,16 @@ class Main {
case 4:
final data:ClientSettings = data;
data.checkboxes = [];
+ case 5:
+ final data:ClientSettings = data;
+ data.checkedCache = [];
+ Reflect.deleteField(data, "playerSize");
+ Reflect.deleteField(data, "isExtendedPlayer");
+ final oldCheck = data.checkboxes.find(item -> item.id == "cache-on-server");
+ if (oldCheck != null) {
+ data.checkboxes.remove(oldCheck);
+ data.checkedCache.push(YoutubeType);
+ }
case SETTINGS_VERSION, _:
throw 'skipped version $version';
}
@@ -307,6 +316,14 @@ class Main {
return player.isSingleVideoUrl(url);
}
+ public function isExternalVideoUrl(url:String):Bool {
+ url = url.ltrim();
+ if (url.startsWith("/")) return false;
+ final host = Browser.location.hostname;
+ if (url.contains(host)) return false;
+ return true;
+ }
+
public function sortItemsForQueueNext<T>(items:Array<T>):Void {
if (items.length == 0) return;
// except first item when list empty
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage