Skip to content

Instantly share code, notes, and snippets.

@sainak
Created November 8, 2023 12:34
Show Gist options
  • Save sainak/c7c6d0efd9cc798fdf4eefd0c0b5ad01 to your computer and use it in GitHub Desktop.
Save sainak/c7c6d0efd9cc798fdf4eefd0c0b5ad01 to your computer and use it in GitHub Desktop.
pake youtube music patch
# https://macosicons.com
https://parsefiles.back4app.com/JPaQcFfEEQ1ePBxbf6wvzkPMEqKYHhPYv8boI1Rc/6ba4356c379a0e212b2af5a8ef1a57ef_YouTube%20Music.icns
diff --git a/src-tauri/icons/youtubemusic.icns b/src-tauri/icons/youtubemusic.icns
index 2e1592b..1979945 100644
Binary files a/src-tauri/icons/youtubemusic.icns and b/src-tauri/icons/youtubemusic.icns differ
diff --git a/src-tauri/pake.json b/src-tauri/pake.json
index 31f5d56..07e0ad5 100644
--- a/src-tauri/pake.json
+++ b/src-tauri/pake.json
@@ -1,7 +1,7 @@
{
"windows": [
{
- "url": "https://weread.qq.com/",
+ "url": "https://music.youtube.com?source=pwa",
"transparent": true,
"fullscreen": false,
"width": 1200,
diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rs
index 24aed37..cc09fcd 100644
--- a/src-tauri/src/app/window.rs
+++ b/src-tauri/src/app/window.rs
@@ -27,7 +27,7 @@ pub fn get_window(app: &mut App, config: PakeConfig, _data_dir: PathBuf) -> Wind
.fullscreen(window_config.fullscreen)
.inner_size(window_config.width, window_config.height)
.disable_file_drop_handler()
- .initialization_script(include_str!("../inject/component.js"))
+ // .initialization_script(include_str!("../inject/component.js"))
.initialization_script(include_str!("../inject/event.js"))
.initialization_script(include_str!("../inject/style.js"))
//This is necessary to allow for file injection by external developers for customization purposes.
diff --git a/src-tauri/src/inject/event.js b/src-tauri/src/inject/event.js
index dbea191..d343774 100644
--- a/src-tauri/src/inject/event.js
+++ b/src-tauri/src/inject/event.js
@@ -83,8 +83,12 @@ document.addEventListener('DOMContentLoaded', () => {
}
});
+ var ytTopBar = document.querySelector("#layout > ytmusic-nav-bar");
domEl.addEventListener('dblclick', () => {
appWindow.isFullscreen().then((fullscreen) => {
+ if (ytTopBar){
+ ytTopBar.style.padding = fullscreen ? "6px 16px 0 72px" : "6px 16px 0 16px";
+ }
appWindow.setFullscreen(!fullscreen).then();
});
});
diff --git a/src-tauri/src/inject/style.js b/src-tauri/src/inject/style.js
index 5baccf8..c309dcc 100644
--- a/src-tauri/src/inject/style.js
+++ b/src-tauri/src/inject/style.js
@@ -1,5 +1,15 @@
window.addEventListener('DOMContentLoaded', _event => {
const css = `
+ html {
+ overscroll-behavior: none;
+ }
+ *::-webkit-scrollbar {
+ display: none !important;
+ }
+ html {
+ -webkit-user-select: none;
+ user-select: none;
+ }
#page #footer-wrapper,
.drawing-board .toolbar .toolbar-action,
.c-swiper-container,
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 09501a2..91c636c 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -1,6 +1,6 @@
{
"package": {
- "productName": "WeRead",
+ "productName": "YouTube Music",
"version": "1.0.0"
},
"tauri": {
@@ -8,7 +8,7 @@
"csp": null,
"dangerousRemoteDomainIpcAccess": [
{
- "domain": "weread.qq.com",
+ "domain": "music.youtube.com",
"windows": ["pake"],
"enableTauriAPI": true
}
@@ -22,11 +22,7 @@
"iconAsTemplate": true
},
"allowlist": {
- "all": true,
- "fs": {
- "all": true,
- "scope": ["$DOWNLOAD/*"]
- }
+ "all": true
}
},
"build": {
diff --git a/src-tauri/tauri.macos.conf.json b/src-tauri/tauri.macos.conf.json
index cdfbfa1..f2d585c 100644
--- a/src-tauri/tauri.macos.conf.json
+++ b/src-tauri/tauri.macos.conf.json
@@ -1,10 +1,10 @@
{
"tauri": {
"bundle": {
- "icon": ["icons/weread.icns"],
- "identifier": "com.pake.weread",
+ "icon": ["icons/youtubemusic.icns"],
+ "identifier": "com.youtube.music",
"active": true,
- "category": "DeveloperTool",
+ "category": "Music",
"copyright": "",
"externalBin": [],
"longDescription": "",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment