fix: quick connect not working

This commit is contained in:
Prayag Prajapati committed 2024-07-25 10:32:46 +05:30
1 parent b59e147a39
commit df91d4a744
17 files changed
+429 -428

No files matched your search

+1 -1
View File
@@ -1 +1 @@
{"encodings":["src\\main.tsx","ProviderWrapper",[40,0,44,1],[41,13,41,42],[42,19,42,54],[43,8,43,71],"src\\utils\\store\\api.tsx","ApiProvider",[57,27,71,1],[57,28,57,40],[58,17,69,2],[70,8,70,75],"useApiInContext",[73,7,79,1],[74,15,74,37],[78,8,78,34],"src\\routes\\_api\\search\\index.jsx","SearchPage",[30,0,448,1],[31,13,31,36],[33,37,33,49],[34,21,34,49],[36,14,44,3],[48,16,62,3],[63,16,77,3],[78,20,92,3],[93,15,107,3],[108,14,122,3],[123,22,137,3],[138,16,150,3],[151,18,164,3],[166,23,166,71],[168,1,171,7],[173,2,446,8],[183,3,236,9],[184,4,235,6],[201,7,230,24],[202,8,229,14],[210,9,227,11],[228,9,228,65],[237,3,421,9],[243,5,262,20],[245,7,260,9],[265,5,290,20],[267,7,288,9],[293,5,307,20],[296,8,304,10],[310,5,329,20],[312,7,327,9],[332,5,352,20],[334,7,350,9],[355,5,375,20],[357,7,373,9],[378,5,397,20],[380,7,395,9],[400,5,419,20],[402,7,417,9],[438,5,444,11],[443,6,443,68],"src\\routes\\_api\\favorite\\index.tsx","FavoritePage",[20,0,304,1],[21,13,21,36],[22,23,22,71],[24,14,32,3],[34,16,45,3],[47,16,58,3],[60,20,71,3],[73,15,84,3],[86,14,97,3],[99,22,110,3],[112,16,123,3],[125,1,127,3],[130,2,302,9],[141,4,160,19],[143,6,158,8],[163,4,188,19],[165,6,186,8],[191,4,210,19],[193,6,208,8],[213,4,233,19],[215,6,231,8],[236,4,256,19],[238,6,254,8],[259,4,278,19],[261,6,276,8],[281,4,300,19],[283,6,298,8],"src\\routes\\_api\\home\\index.tsx","Home",[38,0,419,1],[39,13,39,42],[41,14,49,3],[51,19,61,3],[63,21,83,3],[85,26,99,3],[101,26,114,3],[116,21,135,3],[137,47,137,59],[139,18,139,31],[145,1,162,26],[162,5,162,24],[171,3,416,10],[178,4,205,20],[180,6,180,26],[183,7,202,9],[185,9,185,52],[207,4,241,20],[209,6,211,12],[210,7,210,51],[215,6,215,23],[217,6,239,21],[221,10,236,12],[242,4,303,20],[244,6,246,12],[245,7,245,52],[250,6,250,23],[254,6,301,21],[257,9,298,11],[304,4,362,20],[306,6,308,12],[307,7,307,59],[312,6,312,23],[317,6,360,21],[320,9,357,11],[363,4,404,20],[365,6,367,12],[366,7,366,59],[371,6,371,23],[376,6,402,21],[379,9,399,11],[405,4,415,20],[407,6,409,12],[408,7,408,62],[413,13,413,69],"src\\routes\\setup\\server.add.tsx","ServerSetup",[25,0,152,1],[26,33,26,45],[28,29,28,42],[30,18,30,60],[32,21,66,3],[70,3,79,5],[80,3,149,15],[88,4,148,11],[95,5,97,12],[96,6,96,54],[98,5,108,12],[99,6,107,8],[109,5,123,12],[110,6,122,22],[116,8,116,71],[124,5,147,12],[136,6,143,13],[144,6,146,19],"src\\routes\\_api\\player\\index.tsx","VideoPlayer",[81,0,592,1],[82,13,82,36],[83,21,83,32],[84,39,84,54],[96,5,106,3],[108,31,108,45],[109,41,109,55],[111,51,111,66],[114,31,114,46],[115,31,115,45],[116,35,116,50],[117,45,117,68],[118,33,118,56],[119,43,119,58],[120,43,120,67],[121,49,123,2],[124,29,124,40],[125,27,125,42],[127,1,127,41],[129,49,129,71],[209,16,209,28],[223,24,259,7],[261,1,269,21],[269,5,269,19],[271,1,302,38],[302,5,302,18],[302,20,302,36],[304,1,307,15],[307,5,307,13],[310,2,590,8],[311,3,334,21],[313,5,332,18],[331,6,331,52],[335,3,562,16],[352,4,400,10],[353,5,355,18],[354,6,354,66],[356,5,360,18],[359,6,359,64],[361,5,399,12],[382,6,398,18],[390,7,392,18],[394,8,396,19],[401,4,561,10],[402,5,409,18],[405,7,407,20],[410,5,560,11],[411,6,452,12],[412,7,445,9],[446,7,451,13],[447,8,449,21],[450,8,450,61],[453,6,559,12],[454,7,485,13],[455,8,455,30],[456,8,464,21],[461,9,463,16],[465,8,469,21],[466,9,468,16],[470,8,478,21],[475,9,477,16],[479,8,479,26],[480,8,484,21],[486,7,558,13],[487,8,523,21],[509,9,511,22],[512,9,522,11],[524,8,537,21],[530,9,536,16],[538,8,538,23],[539,8,545,21],[540,9,544,16],[546,8,557,21],[554,9,556,16],[564,3,589,5],"src\\routes\\_api\\login\\index.tsx","LoginRoute",[19,0,91,1],[20,18,20,31],[21,18,21,31],[22,13,22,36],[23,29,23,65],[25,19,32,3],[48,2,89,13],[48,22,48,45],[49,3,88,9],[60,4,60,48],[61,4,87,22],[62,5,86,18],[75,6,85,19],"src\\routes\\setup\\server.list.tsx","ServerList",[28,0,203,1],[29,18,29,31],[30,39,30,53],[31,29,31,42],[33,21,33,37],[35,17,38,3],[40,23,43,3],[45,28,63,3],[87,1,89,7],[92,2,201,8],[93,3,93,21],[94,3,114,9],[103,4,105,17],[106,4,113,17],[112,5,112,56],[115,3,200,11],[118,6,198,12],[119,7,121,13],[122,7,170,13],[123,8,151,21],[133,10,149,12],[135,12,141,25],[152,8,160,21],[161,8,169,21],[171,7,197,13],[172,8,183,21],[182,9,182,62],[184,8,196,21],[195,9,195,71],"src\\routes\\_api\\playlist\\$id.jsx","TabPanel",[23,0,38,1],[23,18,23,23],[27,2,36,8],[35,23,35,44],"PlaylistTitlePage",[57,0,229,1],[58,16,58,33],[59,13,59,36],[61,14,69,3],[71,14,84,3],[86,22,99,3],[101,21,112,3],[114,26,114,74],[116,1,126,7],[130,3,140,9],[139,4,139,24],[145,3,223,9],[160,7,168,9],[174,5,221,20],[181,8,218,10],[227,9,227,24],"src\\routes\\_api\\series\\$id.tsx",[65,0,80,1],[65,18,65,23],[69,2,78,8],[77,23,77,44],"SeriesTitlePage",[99,0,1205,1],[100,16,100,33],[102,13,102,36],[104,14,112,3],[114,14,127,3],[129,22,142,3],[144,17,157,3],[159,23,174,3],[176,43,179,3],[180,55,180,70],[182,43,185,3],[187,27,199,3],[201,18,216,3],[218,25,228,3],[229,26,229,74],[231,35,231,47],[232,31,232,43],[233,29,233,41],[234,35,234,47],[236,1,260,21],[260,5,260,19],[262Line truncated
{"encodings":["src\\main.tsx","ProviderWrapper",[40,0,44,1],[41,13,41,42],[42,19,42,54],[43,8,43,71],"src\\utils\\store\\api.tsx","ApiProvider",[57,27,71,1],[57,28,57,40],[58,17,69,2],[70,8,70,75],"useApiInContext",[73,7,79,1],[74,15,74,37],[78,8,78,34],"src\\routes\\_api\\search\\index.jsx","SearchPage",[30,0,448,1],[31,13,31,36],[33,37,33,49],[34,21,34,49],[36,14,44,3],[48,16,62,3],[63,16,77,3],[78,20,92,3],[93,15,107,3],[108,14,122,3],[123,22,137,3],[138,16,150,3],[151,18,164,3],[166,23,166,71],[168,1,171,7],[173,2,446,8],[183,3,236,9],[184,4,235,6],[201,7,230,24],[202,8,229,14],[210,9,227,11],[228,9,228,65],[237,3,421,9],[243,5,262,20],[245,7,260,9],[265,5,290,20],[267,7,288,9],[293,5,307,20],[296,8,304,10],[310,5,329,20],[312,7,327,9],[332,5,352,20],[334,7,350,9],[355,5,375,20],[357,7,373,9],[378,5,397,20],[380,7,395,9],[400,5,419,20],[402,7,417,9],[438,5,444,11],[443,6,443,68],"src\\routes\\_api\\favorite\\index.tsx","FavoritePage",[20,0,304,1],[21,13,21,36],[22,23,22,71],[24,14,32,3],[34,16,45,3],[47,16,58,3],[60,20,71,3],[73,15,84,3],[86,14,97,3],[99,22,110,3],[112,16,123,3],[125,1,127,3],[130,2,302,9],[141,4,160,19],[143,6,158,8],[163,4,188,19],[165,6,186,8],[191,4,210,19],[193,6,208,8],[213,4,233,19],[215,6,231,8],[236,4,256,19],[238,6,254,8],[259,4,278,19],[261,6,276,8],[281,4,300,19],[283,6,298,8],"src\\routes\\_api\\home\\index.tsx","Home",[38,0,419,1],[39,13,39,42],[41,14,49,3],[51,19,61,3],[63,21,83,3],[85,26,99,3],[101,26,114,3],[116,21,135,3],[137,47,137,59],[139,18,139,31],[145,1,162,26],[162,5,162,24],[171,3,416,10],[178,4,205,20],[180,6,180,26],[183,7,202,9],[185,9,185,52],[207,4,241,20],[209,6,211,12],[210,7,210,51],[215,6,215,23],[217,6,239,21],[221,10,236,12],[242,4,303,20],[244,6,246,12],[245,7,245,52],[250,6,250,23],[254,6,301,21],[257,9,298,11],[304,4,362,20],[306,6,308,12],[307,7,307,59],[312,6,312,23],[317,6,360,21],[320,9,357,11],[363,4,404,20],[365,6,367,12],[366,7,366,59],[371,6,371,23],[376,6,402,21],[379,9,399,11],[405,4,415,20],[407,6,409,12],[408,7,408,62],[413,13,413,69],"src\\routes\\setup\\server.add.tsx","ServerSetup",[25,0,152,1],[26,33,26,45],[28,29,28,42],[30,18,30,60],[32,21,66,3],[70,3,79,5],[80,3,149,15],[88,4,148,11],[95,5,97,12],[96,6,96,54],[98,5,108,12],[99,6,107,8],[109,5,123,12],[110,6,122,22],[116,8,116,71],[124,5,147,12],[136,6,143,13],[144,6,146,19],"src\\routes\\_api\\player\\index.tsx","VideoPlayer",[81,0,592,1],[82,13,82,36],[83,21,83,32],[84,39,84,54],[96,5,106,3],[108,31,108,45],[109,41,109,55],[111,51,111,66],[114,31,114,46],[115,31,115,45],[116,35,116,50],[117,45,117,68],[118,33,118,56],[119,43,119,58],[120,43,120,67],[121,49,123,2],[124,29,124,40],[125,27,125,42],[127,1,127,41],[129,49,129,71],[209,16,209,28],[223,24,259,7],[261,1,269,21],[269,5,269,19],[271,1,302,38],[302,5,302,18],[302,20,302,36],[304,1,307,15],[307,5,307,13],[310,2,590,8],[311,3,334,21],[313,5,332,18],[331,6,331,52],[335,3,562,16],[352,4,400,10],[353,5,355,18],[354,6,354,66],[356,5,360,18],[359,6,359,64],[361,5,399,12],[382,6,398,18],[390,7,392,18],[394,8,396,19],[401,4,561,10],[402,5,409,18],[405,7,407,20],[410,5,560,11],[411,6,452,12],[412,7,445,9],[446,7,451,13],[447,8,449,21],[450,8,450,61],[453,6,559,12],[454,7,485,13],[455,8,455,30],[456,8,464,21],[461,9,463,16],[465,8,469,21],[466,9,468,16],[470,8,478,21],[475,9,477,16],[479,8,479,26],[480,8,484,21],[486,7,558,13],[487,8,523,21],[509,9,511,22],[512,9,522,11],[524,8,537,21],[530,9,536,16],[538,8,538,23],[539,8,545,21],[540,9,544,16],[546,8,557,21],[554,9,556,16],[564,3,589,5],"src\\routes\\_api\\login\\index.tsx","LoginRoute",[19,0,91,1],[20,18,20,31],[21,18,21,31],[22,13,22,36],[23,29,23,65],[25,19,32,3],[48,2,89,13],[48,22,48,45],[49,3,88,9],[60,4,60,48],[61,4,87,22],[62,5,86,18],[75,6,85,19],"src\\routes\\setup\\server.list.tsx","ServerList",[28,0,203,1],[29,18,29,31],[30,39,30,53],[31,29,31,42],[33,21,33,37],[35,17,38,3],[40,23,43,3],[45,28,63,3],[87,1,89,7],[92,2,201,8],[93,3,93,21],[94,3,114,9],[103,4,105,17],[106,4,113,17],[112,5,112,56],[115,3,200,11],[118,6,198,12],[119,7,121,13],[122,7,170,13],[123,8,151,21],[133,10,149,12],[135,12,141,25],[152,8,160,21],[161,8,169,21],[171,7,197,13],[172,8,183,21],[182,9,182,62],[184,8,196,21],[195,9,195,71],"src\\routes\\_api\\playlist\\$id.jsx","TabPanel",[23,0,38,1],[23,18,23,23],[27,2,36,8],[35,23,35,44],"PlaylistTitlePage",[57,0,229,1],[58,16,58,33],[59,13,59,36],[61,14,69,3],[71,14,84,3],[86,22,99,3],[101,21,112,3],[114,26,114,74],[116,1,126,7],[130,3,140,9],[139,4,139,24],[145,3,223,9],[160,7,168,9],[174,5,221,20],[181,8,218,10],[227,9,227,24],"src\\routes\\_api\\series\\$id.tsx",[65,0,80,1],[65,18,65,23],[69,2,78,8],[77,23,77,44],"SeriesTitlePage",[99,0,1205,1],[100,16,100,33],[102,13,102,36],[104,14,112,3],[114,14,127,3],[129,22,142,3],[144,17,157,3],[159,23,174,3],[176,43,179,3],[180,55,180,70],[182,43,185,3],[187,27,199,3],[201,18,216,3],[218,25,228,3],[229,26,229,74],[231,35,231,47],[232,31,232,43],[233,29,233,41],[234,35,234,47],[236,1,260,21],[260,5,260,19],[262Line truncated
+1
View File
@@ -29,6 +29,7 @@
"@tanstack/react-router": "^1.45.8",
"@tanstack/react-virtual": "^3.8.3",
"@tauri-apps/api": "2.0.0-beta.15",
"@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.5",
"@tauri-apps/plugin-process": "2.0.0-beta.7",
"@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2",
"@tauri-apps/plugin-updater": "2.0.0-beta.7",
+12 -2
View File
@@ -56,6 +56,9 @@ importers:
'@tauri-apps/api':
specifier: 2.0.0-beta.15
version: 2.0.0-beta.15
'@tauri-apps/plugin-clipboard-manager':
specifier: 2.1.0-beta.5
version: 2.1.0-beta.5
'@tauri-apps/plugin-process':
specifier: 2.0.0-beta.7
version: 2.0.0-beta.7
@@ -1313,6 +1316,9 @@ packages:
engines: {node: '>= 10'}
hasBin: true
'@tauri-apps/plugin-clipboard-manager@2.1.0-beta.5':
resolution: {integrity: sha512-7YQEXRHXn5dIr/YcE7RtkoAhc6XwpqI7Qz0I3FcHn5vMbVvQ5OxKnGqEa8ZGRud6R3G9pNdnEKglLXLgUXK8tA==}
'@tauri-apps/plugin-process@2.0.0-beta.7':
resolution: {integrity: sha512-iK4HYnzeyqAZE5HAKd0mDI7ekYXUqA9azjA9AgL4LscOEHma1XGEP0DlcHn+RrXIvVbI4LwCol9DSNNoIrB0+w==}
@@ -3278,8 +3284,8 @@ snapshots:
dependencies:
'@antfu/ni': 0.21.12
'@axiomhq/js': 1.0.0-rc.3
'@babel/core': 7.24.6
'@babel/types': 7.24.6
'@babel/core': 7.24.9
'@babel/types': 7.24.9
'@clack/prompts': 0.7.0
cli-high: 0.4.2
diff: 5.2.0
@@ -3815,6 +3821,10 @@ snapshots:
'@tauri-apps/cli-win32-ia32-msvc': 2.0.0-beta.22
'@tauri-apps/cli-win32-x64-msvc': 2.0.0-beta.22
'@tauri-apps/plugin-clipboard-manager@2.1.0-beta.5':
dependencies:
'@tauri-apps/api': 2.0.0-beta.15
'@tauri-apps/plugin-process@2.0.0-beta.7':
dependencies:
'@tauri-apps/api': 2.0.0-beta.15
+1
View File
@@ -26,6 +26,7 @@ tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-works
portpicker = "0.1" # used in the example to pick a random free port
tauri-plugin-process = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
tauri-plugin-updater = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
tauri-plugin-clipboard-manager = "2.1.0-beta.6"
[features]
# by default Tauri runs in production mode
+1 -1
View File
@@ -1,3 +1,3 @@
fn main() {
tauri_build::build()
tauri_build::build()
}
+1 -1
View File
@@ -1 +1 @@
{"app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","commands":{"allow":["name"],"deny":[]}},"allow-tauri-version":{"identifier":"allow-tauri-version","description":"Enables the tauri_version command without any pre-configured scope.","commands":{"allow":["tauri_version"],"deny":[]}},"allow-version":{"identifier":"allow-version","description":"Enables the version command without any pre-configured scope.","commands":{"allow":["version"],"deny":[]}},"deny-app-hide":{"identifier":"deny-app-hide","description":"Denies the app_hide command without any pre-configured scope.","commands":{"allow":[],"deny":["app_hide"]}},"deny-app-show":{"identifier":"deny-app-show","description":"Denies the app_show command without any pre-configured scope.","commands":{"allow":[],"deny":["app_show"]}},"deny-default-window-icon":{"identifier":"deny-default-window-icon","description":"Denies the default_window_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["default_window_icon"]}},"deny-name":{"identifier":"deny-name","description":"Denies the name command without any pre-configured scope.","commands":{"allow":[],"deny":["name"]}},"deny-tauri-version":{"identifier":"deny-tauri-version","description":"Denies the tauri_version command without any pre-configured scope.","commands":{"allow":[],"deny":["tauri_version"]}},"deny-version":{"identifier":"deny-version","description":"Denies the version command without any pre-configured scope.","commands":{"allow":[],"deny":["version"]}}},"permission_sets":{},"global_scope_schema":null},"event":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-listen","allow-unlisten","allow-emit","allow-emit-to"]},"permissions":{"allow-emit":{"identifier":"allow-emit","description":"Enables the emit command without any pre-configured scope.","commands":{"allow":["emit"],"deny":[]}},"allow-emit-to":{"identifier":"allow-emit-to","description":"Enables the emit_to command without any pre-configured scope.","commands":{"allow":["emit_to"],"deny":[]}},"allow-listen":{"identifier":"allow-listen","description":"Enables the listen command without any pre-configured scope.","commands":{"allow":["listen"],"deny":[]}},"allow-unlisten":{"identifier":"allow-unlisten","description":"Enables the unlisten command without any pre-configured scope.","commands":{"allow":["unlisten"],"deny":[]}},"deny-emit":{"identifier":"deny-emit","description":"Denies the emit command without any pre-configured scope.","commands":{"allow":[],"deny":["emit"]}},"deny-emit-to":{"identifier":"deny-emit-to","description":"Denies the emit_to command without any pre-configured scope.","commands":{"allow":[],"deny":["emit_to"]}},"deny-listen":{"identifier":"deny-listen","description":"Denies the listen command without any pre-configured scope.","commands":{"allow":[],"deny":["listen"]}},"deny-unlisten":{"identifier":"deny-unlisten","description":"Denies the unlisten command without any pre-configured scope.","commands":{"allow":[],"deny":["unlisten"]}}},"permission_sets":{},"global_scope_schema":null},"image":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-new","allow-from-bytes","allow-from-path","allow-rgba","allow-size"]},"permissions":{"allow-from-bytes":{"identifier":"allow-from-bytes","description":"Enables the from_bytes command without any pre-configured scope.","commands":{"allow":["from_bytes"],"deny":[]}},"allow-from-path":{"identifier":"allow-from-path","description":"Enables the from_path command without any pre-configured scope.","commands":{"allow":["from_path"],"deny":[]}},"allow-new":{"identifier":"allow-new","description":"Enables the new command without any pre-configured scope.","commands":{"allow":["new"],"deny":[]}},"allow-rgba":{"identifier":"allow-rgba","description":"Enables the rgba command without any pre-configured scope.","commands":{"allow":["rgba"],"deny":[]}},"allow-size":{"identifier":"allow-size","description":"Enables the size command without any pre-configured scope.","commands":{"allow":["size"],"deny":[]}},"deny-from-bytes":{"identifier":"denyLine truncated
{"app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","commands":{"allow":["name"],"deny":[]}},"allow-tauri-version":{"identifier":"allow-tauri-version","description":"Enables the tauri_version command without any pre-configured scope.","commands":{"allow":["tauri_version"],"deny":[]}},"allow-version":{"identifier":"allow-version","description":"Enables the version command without any pre-configured scope.","commands":{"allow":["version"],"deny":[]}},"deny-app-hide":{"identifier":"deny-app-hide","description":"Denies the app_hide command without any pre-configured scope.","commands":{"allow":[],"deny":["app_hide"]}},"deny-app-show":{"identifier":"deny-app-show","description":"Denies the app_show command without any pre-configured scope.","commands":{"allow":[],"deny":["app_show"]}},"deny-default-window-icon":{"identifier":"deny-default-window-icon","description":"Denies the default_window_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["default_window_icon"]}},"deny-name":{"identifier":"deny-name","description":"Denies the name command without any pre-configured scope.","commands":{"allow":[],"deny":["name"]}},"deny-tauri-version":{"identifier":"deny-tauri-version","description":"Denies the tauri_version command without any pre-configured scope.","commands":{"allow":[],"deny":["tauri_version"]}},"deny-version":{"identifier":"deny-version","description":"Denies the version command without any pre-configured scope.","commands":{"allow":[],"deny":["version"]}}},"permission_sets":{},"global_scope_schema":null},"clipboard-manager":{"default_permission":{"identifier":"default","description":"No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n","permissions":[]},"permissions":{"allow-clear":{"identifier":"allow-clear","description":"Enables the clear command without any pre-configured scope.","commands":{"allow":["clear"],"deny":[]}},"allow-read-image":{"identifier":"allow-read-image","description":"Enables the read_image command without any pre-configured scope.","commands":{"allow":["read_image"],"deny":[]}},"allow-read-text":{"identifier":"allow-read-text","description":"Enables the read_text command without any pre-configured scope.","commands":{"allow":["read_text"],"deny":[]}},"allow-write-html":{"identifier":"allow-write-html","description":"Enables the write_html command without any pre-configured scope.","commands":{"allow":["write_html"],"deny":[]}},"allow-write-image":{"identifier":"allow-write-image","description":"Enables the write_image command without any pre-configured scope.","commands":{"allow":["write_image"],"deny":[]}},"allow-write-text":{"identifier":"allow-write-text","description":"Enables the write_text command without any pre-configured scope.","commands":{"allow":["write_text"],"deny":[]}},"deny-clear":{"identifier":"deny-clear","description":"Denies the clear command without any pre-configured scope.","commands":{"allow":[],"deny":["clear"]}},"deny-read-image":{"identifier":"deny-read-image","description":"Denies the read_image command without any pre-configured scope.","commands":{"allow":[],"deny":["read_image"]}},"deny-read-text":{"identifier":"deny-read-text","description":"Denies the read_text command without any pre-configured scope.","commands":{"allow":[],"deny":["read_text"]}},"deny-write-html":{"identifier":"deny-write-html","description":"Denies the write_html command without any pre-configured scope.","commands":{"allow":[],"deny":["write_html"]}},"deny-write-image":{"identifier":"deny-write-image","description":"Denies the write_image command without any pre-configured scope.","commands":{"allow":[],"deny":["write_image"]}},"deny-write-text":{"identifier":"deny-write-text","description":"Denies the write_text command without any pre-configured scope.","commands":{"allow":[],"deny":["write_text"]}}},"permission_sets":{},"global_scope_schema":null},"event":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-listen",Line truncated
+91
View File
@@ -262,6 +262,97 @@
"app:deny-version"
]
},
{
"description": "clipboard-manager:default -> No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n",
"type": "string",
"enum": [
"clipboard-manager:default"
]
},
{
"description": "clipboard-manager:allow-clear -> Enables the clear command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:allow-clear"
]
},
{
"description": "clipboard-manager:allow-read-image -> Enables the read_image command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:allow-read-image"
]
},
{
"description": "clipboard-manager:allow-read-text -> Enables the read_text command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:allow-read-text"
]
},
{
"description": "clipboard-manager:allow-write-html -> Enables the write_html command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:allow-write-html"
]
},
{
"description": "clipboard-manager:allow-write-image -> Enables the write_image command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:allow-write-image"
]
},
{
"description": "clipboard-manager:allow-write-text -> Enables the write_text command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:allow-write-text"
]
},
{
"description": "clipboard-manager:deny-clear -> Denies the clear command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:deny-clear"
]
},
{
"description": "clipboard-manager:deny-read-image -> Denies the read_image command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:deny-read-image"
]
},
{
"description": "clipboard-manager:deny-read-text -> Denies the read_text command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:deny-read-text"
]
},
{
"description": "clipboard-manager:deny-write-html -> Denies the write_html command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:deny-write-html"
]
},
{
"description": "clipboard-manager:deny-write-image -> Denies the write_image command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:deny-write-image"
]
},
{
"description": "clipboard-manager:deny-write-text -> Denies the write_text command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:deny-write-text"
]
},
{
"description": "event:default -> Default permissions for the plugin.",
"type": "string",
+91
View File
@@ -262,6 +262,97 @@
"app:deny-version"
]
},
{
"description": "clipboard-manager:default -> No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n",
"type": "string",
"enum": [
"clipboard-manager:default"
]
},
{
"description": "clipboard-manager:allow-clear -> Enables the clear command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:allow-clear"
]
},
{
"description": "clipboard-manager:allow-read-image -> Enables the read_image command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:allow-read-image"
]
},
{
"description": "clipboard-manager:allow-read-text -> Enables the read_text command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:allow-read-text"
]
},
{
"description": "clipboard-manager:allow-write-html -> Enables the write_html command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:allow-write-html"
]
},
{
"description": "clipboard-manager:allow-write-image -> Enables the write_image command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:allow-write-image"
]
},
{
"description": "clipboard-manager:allow-write-text -> Enables the write_text command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:allow-write-text"
]
},
{
"description": "clipboard-manager:deny-clear -> Denies the clear command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:deny-clear"
]
},
{
"description": "clipboard-manager:deny-read-image -> Denies the read_image command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:deny-read-image"
]
},
{
"description": "clipboard-manager:deny-read-text -> Denies the read_text command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:deny-read-text"
]
},
{
"description": "clipboard-manager:deny-write-html -> Denies the write_html command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:deny-write-html"
]
},
{
"description": "clipboard-manager:deny-write-image -> Denies the write_image command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:deny-write-image"
]
},
{
"description": "clipboard-manager:deny-write-text -> Denies the write_text command without any pre-configured scope.",
"type": "string",
"enum": [
"clipboard-manager:deny-write-text"
]
},
{
"description": "event:default -> Default permissions for the plugin.",
"type": "string",
+1
View File
@@ -4,6 +4,7 @@ use tauri_plugin_log::{fern::colors::ColoredLevelConfig, Target, TargetKind};
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_clipboard_manager::init())
.plugin(
tauri_plugin_log::Builder::default()
.targets([Target::new(TargetKind::Webview)])
+1 -1
View File
@@ -85,7 +85,7 @@ export const AppBar = () => {
const usr = await getUserApi(api).getCurrentUser();
return usr.data;
},
enabled: display && Boolean(api),
enabled: display && Boolean(api.accessToken),
throwOnError: true,
});
const libraries = useQuery({
@@ -0,0 +1,205 @@
import { saveUser } from "@/utils/storage/user";
import { useApiInContext } from "@/utils/store/api";
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { LoadingButton } from "@mui/lab";
import {
Button,
Checkbox,
Dialog,
DialogActions,
DialogContent,
DialogContentText,
FormControlLabel,
Tooltip,
Typography,
} from "@mui/material";
import { useMutation, useQuery } from "@tanstack/react-query";
import { useNavigate } from "@tanstack/react-router";
import type { Timeout } from "@tanstack/react-router/dist/esm/utils";
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
import { useSnackbar } from "notistack";
import React, { useState } from "react";
const QuickConnectButton = () => {
const api = useApiInContext((s) => s.api);
const createApi = useApiInContext((s) => s.createApi);
const headers = {
"X-Emby-Authorization": `MediaBrowser Client="${api.clientInfo.name}", Device="${api.deviceInfo.name}", DeviceId="${api.deviceInfo.id}", Version="${api.clientInfo.version}"`,
};
const [quickConnectStatusInterval, setQuickConnectStatusInterval] =
useState<Timeout | null>(null);
const quickConnectEnabled = useQuery({
queryKey: ["quick-connect-button", "check-quick-connect-enabled"],
queryFn: async () => await getQuickConnectApi(api).getQuickConnectEnabled(),
});
const navigate = useNavigate();
const { enqueueSnackbar } = useSnackbar();
const [quickConnectCode, setQuickConnectCode] = useState<string | null>();
const [rememberUser, setRememberUser] = useState(true);
const checkQuickConnectStatus = useMutation({
mutationKey: ["quick-connect-button", "check-quick-connect-status"],
mutationFn: async (secret: string) =>
(
await getQuickConnectApi(api).getQuickConnectState(
{ secret },
{ headers },
)
).data,
});
const initQuickConnect = useMutation({
mutationKey: ["quick-connect-button", "initiate-connection"],
mutationFn: async () => {
if (!quickConnectEnabled.data?.data) {
enqueueSnackbar("Quick Connect is not enabled on server.", {
variant: "error",
});
}
return await getQuickConnectApi(api).initiateQuickConnect({ headers });
},
onSuccess: (result) => {
setQuickConnectCode(result.data.Code);
const authAwaitInterval = setInterval(async () => {
// Check if user has been authenticated by the server
const quickConnectCheck = await checkQuickConnectStatus.mutateAsync(
result.data.Secret,
);
if (quickConnectCheck.Authenticated) {
const userAuth = await getUserApi(api).authenticateWithQuickConnect({
quickConnectDto: {
Secret: quickConnectCheck.Secret,
},
});
enqueueSnackbar(`Logged in as ${userAuth.data.User?.Name}!`, {
variant: "success",
});
sessionStorage.setItem("accessToken", userAuth.data.AccessToken);
createApi(api.basePath, userAuth.data.AccessToken);
if (rememberUser) {
await saveUser(userAuth.data.User?.Name, userAuth.data.AccessToken);
}
clearInterval(authAwaitInterval);
navigate({ to: "/home" });
}
}, 1000);
setQuickConnectStatusInterval(authAwaitInterval);
},
onError: (error) => {
enqueueSnackbar("Error initiating Quick Connect.", { variant: "error" });
console.error(error);
},
});
return (
<>
<LoadingButton
disabled={
quickConnectEnabled.isPending ||
Boolean(!quickConnectEnabled.data?.data)
}
loading={
initQuickConnect.isPending ||
checkQuickConnectStatus.isPending ||
(quickConnectCode && !checkQuickConnectStatus.data?.Authenticated)
}
variant="contained"
size="large"
style={{ flex: 1 }}
onClick={initQuickConnect.mutate}
>
Quick Connect
</LoadingButton>
<Dialog
open={Boolean(quickConnectCode)}
onClose={() => {
setQuickConnectCode(null);
clearInterval(quickConnectStatusInterval);
}}
fullWidth
maxWidth="xs"
>
<DialogContent
style={{
display: "flex",
flexDirection: "column",
alignItems: "center",
}}
>
<Typography
variant="h5"
mb={2}
style={{
width: "100%",
}}
>
Quick Connect Code:
</Typography>
<DialogContentText>
Use this code in the Quick Connect tab in your server to login.
</DialogContentText>
<div
className="flex flex-row"
style={{ gap: "1em", alignItems: "center", marginTop: "1em" }}
>
<Tooltip title="Click to copy" arrow placement="top">
<Typography
variant="h3"
color="textPrimary"
textAlign="center"
sx={{
background: "rgb(255 255 255 / 0.1)",
width: "fit-content",
padding: "0.4em",
borderRadius: "10px",
cursor: "pointer",
}}
onClick={async (e) => {
await writeText(quickConnectCode);
enqueueSnackbar("Quick Connect Code copied!", {
variant: "info",
key: "copiedText",
});
}}
>
{quickConnectCode}
</Typography>
</Tooltip>
</div>
</DialogContent>
<DialogActions
className="flex flex-row"
sx={{
padding: "0em 1em 1em 1em",
justifyContent: "space-between",
}}
>
<FormControlLabel
control={
<Checkbox
checked={rememberUser}
onChange={(e) => setRememberUser(e.target.checked)}
/>
}
label="Remember device"
/>
<Button
variant="contained"
onClick={() => {
setQuickConnectCode(null);
}}
>
Close
</Button>
</DialogActions>
</Dialog>
</>
);
};
export default QuickConnectButton;
+3 -1
View File
@@ -35,7 +35,6 @@ export const Route = createFileRoute("/_api")({
const apiTemp = context.jellyfinSDK.createApi(
currentServer?.address,
userOnDisk.AccessToken,
axiosClient,
);
try {
await getUserApi(apiTemp).getCurrentUser();
@@ -48,10 +47,13 @@ export const Route = createFileRoute("/_api")({
},
});
}
return { api: apiTemp };
}
context.createApi(currentServer?.address, userOnDisk.AccessToken);
} else {
const apiTemp = context.jellyfinSDK.createApi(currentServer?.address, null);
context.createApi(currentServer?.address, undefined); // Creates Api
return { api: apiTemp };
}
}
} else if (context.api) {
+4 -1
View File
@@ -5,7 +5,10 @@ export const Route = createFileRoute("/_api/login")({
beforeLoad: async ({ context, location }) => {
if (location.pathname === "/login") {
const api = context.api;
console.log(api);
if (!api) {
console.info("Awaiting Api generation.");
return;
}
const publicUsers = (await getUserApi(api).getPublicUsers()).data;
if (publicUsers.length > 0) {
throw redirect({ to: "/login/list" });
+8 -219
View File
@@ -1,41 +1,21 @@
import { EventEmitter as event } from "@/eventEmitter.js";
import { useMutation, useQuery } from "@tanstack/react-query";
import React, { useLayoutEffect, useState } from "react";
import { useQuery } from "@tanstack/react-query";
import React, { useLayoutEffect } from "react";
import { saveUser } from "@/utils/storage/user.js";
import LoadingButton from "@mui/lab/LoadingButton";
import {
Dialog,
DialogActions,
DialogContent,
DialogContentText,
Grid,
OutlinedInput,
Paper,
Tooltip,
Typography,
} from "@mui/material";
import { Grid, Typography } from "@mui/material";
import Button from "@mui/material/Button";
import Checkbox from "@mui/material/Checkbox";
import Container from "@mui/material/Container";
import FormControlLabel from "@mui/material/FormControlLabel";
import LinearProgress from "@mui/material/LinearProgress";
import { useSnackbar } from "notistack";
import { AppBarBackOnly } from "@/components/appBar/backOnly.jsx";
import { Card } from "@/components/card/card.js";
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice.jsx";
import "./login.scss";
import QuickConnectButton from "@/components/buttons/quickConnectButton";
import { useApiInContext } from "@/utils/store/api";
import { setBackdrop } from "@/utils/store/backdrop.js";
import { blue } from "@mui/material/colors";
import { createFileRoute, useNavigate } from "@tanstack/react-router";
export const Route = createFileRoute("/_api/login/list")({
@@ -45,25 +25,13 @@ export const Route = createFileRoute("/_api/login/list")({
function LoginPublicUsersList() {
const navigate = useNavigate();
const { enqueueSnackbar } = useSnackbar();
const api = useApiInContext((s) => s.api);
const createApi = useApiInContext((s) => s.createApi);
const [loading, setLoading] = useState(false);
const [rememberMe, setRememberMe] = useState(true);
const [quickConnectLoading, setQuickConnectLoading] = useState(-1);
const [quickConnectCode, setQuickConnectCode] = useState("");
const handleCheckRememberMe = (event) => {
setRememberMe(event.target.checked);
};
const handleChangeServer = () => {
// navigate("/servers/list");
navigate({ to: "/setup/server/list" });
};
const handleManualLogin = () => {
// navigate("/login/manual");
navigate({ to: "/login/manual" });
};
const users = useQuery({
queryKey: ["login", "public-users"],
@@ -74,102 +42,9 @@ function LoginPublicUsersList() {
enabled: Boolean(api),
});
const handleQuickConnect = async () => {
setQuickConnectLoading(0);
const quickApi = getQuickConnectApi(api);
const headers = {
"X-Emby-Authorization": `MediaBrowser Client="${api.clientInfo.name}", Device="${api.deviceInfo.name}", DeviceId="${api.deviceInfo.id}", Version="${api.clientInfo.version}"`,
};
const quickConnectInitiation = await quickApi
.initiate({
headers,
})
.catch(() => ({ status: 401 }));
if (quickConnectInitiation.status !== 200) {
setQuickConnectLoading(-1);
enqueueSnackbar("Unable to use Quick Connect", {
variant: "error",
});
return;
}
setQuickConnectLoading(1);
const { Secret, Code } = quickConnectInitiation.data;
setQuickConnectCode(Code);
const interval = setInterval(async () => {
const quickConnectCheck = await quickApi
.connect({
secret: Secret,
})
.catch(() => ({ status: 401, data: { Authenticated: false } }));
if (quickConnectCheck.status !== 200) {
setQuickConnectCode("");
enqueueSnackbar("Unable to use Quick Connect", {
variant: "error",
});
setQuickConnectLoading(-1);
clearInterval(interval);
return;
}
if (!quickConnectCheck.data.Authenticated) {
return;
}
const auth = await getUserApi(api)
.authenticateWithQuickConnect({
quickConnectDto: {
Secret: Secret,
},
})
.catch(() => ({ status: 401 }));
api.accessToken = auth.data.AccessToken;
clearInterval(interval);
if (auth.status !== 200) {
enqueueSnackbar("Unable to use Quick Connect", {
variant: "error",
});
setQuickConnectLoading(-1);
return;
}
sessionStorage.setItem("accessToken", auth.data.AccessToken);
createApi(api.basePath, auth.data.AccessToken);
if (rememberMe === true) {
await saveUser(auth.data.User.Name, auth.data.AccessToken);
}
setQuickConnectLoading(-1);
enqueueSnackbar(`Logged in as ${auth.data.User.Name}!`, {
variant: "success",
});
navigate("/home");
}, 1000);
setLoading(false);
};
useLayoutEffect(() => {
setBackdrop("", "");
}, []);
if (users.isPending) {
return <LinearProgress />;
}
if (users.isSuccess) {
return (
<>
@@ -242,16 +117,7 @@ function LoginPublicUsersList() {
>
Change Server
</Button>
<LoadingButton
onClick={handleQuickConnect}
variant="contained"
className="userEventButton"
sx={{ width: "100%" }}
loading={quickConnectLoading === 1}
size="large"
>
Quick Connect
</LoadingButton>
<QuickConnectButton />
<Button
variant="contained"
className="userEventButton"
@@ -261,88 +127,11 @@ function LoginPublicUsersList() {
Manual Login
</Button>
</div>
<Dialog open={Boolean(quickConnectCode)} fullWidth maxWidth="xs">
<DialogContent
style={{
display: "flex",
flexDirection: "column",
alignItems: "center",
}}
>
<Typography
variant="h5"
mb={2}
style={{
width: "100%",
}}
>
Quick Connect Code:
</Typography>
<DialogContentText>
Use this code in the Quick Connect tab in your server to login.
</DialogContentText>
<div
className="flex flex-row"
style={{ gap: "1em", alignItems: "center", marginTop: "1em" }}
>
<Tooltip title="Click to copy" arrow placement="top">
<Typography
variant="h3"
color="textPrimary"
textAlign="center"
sx={{
background: "rgb(255 255 255 / 0.1)",
width: "fit-content",
padding: "0.4em",
borderRadius: "10px",
cursor: "pointer",
}}
onClick={(e) => {
navigator.clipboard.writeText(quickConnectCode);
enqueueSnackbar("Quick Connect Code copied!", {
variant: "info",
key: "copiedText",
});
}}
>
{quickConnectCode}
</Typography>
</Tooltip>
</div>
</DialogContent>
<DialogActions
className="flex flex-row"
sx={{
padding: "0em 1em 1em 1em",
justifyContent: "space-between",
}}
>
<FormControlLabel
control={
<Checkbox
checked={rememberMe}
onChange={handleCheckRememberMe}
/>
}
label="Remember device"
/>
<Button
variant="contained"
onClick={() => {
setQuickConnectCode("");
setQuickConnectLoading(-1);
}}
>
Close
</Button>
</DialogActions>
</Dialog>
</Container>
</>
);
}
if (users.isError) {
return <ErrorNotice />;
return <ErrorNotice error="" />;
}
}
+1 -1
View File
@@ -25,7 +25,7 @@
display: flex;
gap: 1em;
width: 100%;
.userEventButton {
>* {
flex: 1 1 0 !important;
}
}
+4 -198
View File
@@ -1,28 +1,14 @@
import { queryOptions, useMutation, useQuery } from "@tanstack/react-query";
import { useMutation, useQuery } from "@tanstack/react-query";
import React, { type FormEvent, useLayoutEffect, useState } from "react";
import { saveUser } from "@/utils/storage/user.js";
import LoadingButton from "@mui/lab/LoadingButton";
import {
Dialog,
DialogActions,
DialogContent,
DialogContentText,
FilledInput,
Grid,
OutlinedInput,
Paper,
TextField,
Tooltip,
Typography,
} from "@mui/material";
import { OutlinedInput, Paper, TextField, Typography } from "@mui/material";
import Button from "@mui/material/Button";
import Checkbox from "@mui/material/Checkbox";
import Container from "@mui/material/Container";
import FormControl from "@mui/material/FormControl";
import FormControlLabel from "@mui/material/FormControlLabel";
import FormGroup from "@mui/material/FormGroup";
import IconButton from "@mui/material/IconButton";
import InputAdornment from "@mui/material/InputAdornment";
import InputLabel from "@mui/material/InputLabel";
@@ -32,29 +18,22 @@ import { useSnackbar } from "notistack";
import { AppBarBackOnly } from "@/components/appBar/backOnly.jsx";
import { axiosClient, useApiInContext } from "@/utils/store/api.js";
import { getBrandingApi } from "@jellyfin/sdk/lib/utils/api/branding-api";
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import "./login.scss";
import QuickConnectButton from "@/components/buttons/quickConnectButton";
import { setBackdrop } from "@/utils/store/backdrop.js";
import { blue } from "@mui/material/colors";
import {
createFileRoute,
useNavigate,
useRouteContext,
useRouter,
useRouterState,
} from "@tanstack/react-router";
import { redirect } from "@tanstack/react-router";
export const Route = createFileRoute("/_api/login/manual")({
component: UserLoginManual,
});
function UserLoginManual() {
const [loading, setLoading] = useState(false);
const [quickConnectLoading, setQuickConnectLoading] = useState(-1);
const [quickConnectCode, setQuickConnectCode] = useState("");
const [rememberMe, setRememberMe] = useState(true);
// console.log(Route.useRouteContext());
const api = useApiInContext((s) => s.api);
@@ -137,94 +116,6 @@ function UserLoginManual() {
setRememberMe(event.target.checked);
};
const handleQuickConnect = async () => {
setQuickConnectLoading(0);
const quickApi = getQuickConnectApi(api);
const headers = {
"X-Emby-Authorization": `MediaBrowser Client="${api.clientInfo.name}", Device="${api.deviceInfo.name}", DeviceId="${api.deviceInfo.id}", Version="${api.clientInfo.version}"`,
};
const quickConnectInitiation = await quickApi
.initiate({
headers,
})
.catch(() => ({ status: 401 }));
if (quickConnectInitiation.status !== 200) {
setQuickConnectCode("");
setQuickConnectLoading(-1);
enqueueSnackbar("Unable to use Quick Connect", {
variant: "error",
});
return;
}
setQuickConnectLoading(1);
const { Secret, Code } = quickConnectInitiation.data;
setQuickConnectCode(Code);
const interval = setInterval(async () => {
const quickConnectCheck = await quickApi
.connect({
secret: Secret,
})
.catch(() => ({ status: 401, data: { Authenticated: false } }));
if (quickConnectCheck.status !== 200) {
enqueueSnackbar("Unable to use Quick Connect", {
variant: "error",
});
setQuickConnectLoading(-1);
clearInterval(interval);
return;
}
if (!quickConnectCheck.data.Authenticated) {
return;
}
const auth = await getUserApi(api)
.authenticateWithQuickConnect({
quickConnectDto: {
Secret: Secret,
},
})
.catch(() => ({ status: 401 }));
api.accessToken = auth.data.AccessToken;
clearInterval(interval);
if (auth.status !== 200) {
enqueueSnackbar("Unable to use Quick Connect", {
variant: "error",
});
setQuickConnectLoading(-1);
return;
}
sessionStorage.setItem("accessToken", auth.data.AccessToken);
createApi(api.basePath, auth.data.AccessToken);
if (rememberMe === true) {
await saveUser(userName, auth.data.AccessToken);
}
setQuickConnectLoading(-1);
enqueueSnackbar(`Logged in as ${auth.data.User.Name}!`, {
variant: "success",
});
navigate({ to: "/home" });
}, 1000);
setLoading(false);
};
useLayoutEffect(() => {
setBackdrop("", "");
}, []);
@@ -296,16 +187,7 @@ function UserLoginManual() {
>
Login
</LoadingButton>
<LoadingButton
onClick={handleQuickConnect}
variant="contained"
className="userEventButton"
style={{ flex: 1 }}
loading={quickConnectLoading === 1}
// size="large"
>
Quick Connect
</LoadingButton>
<QuickConnectButton />
<Button
color="secondary"
variant="contained"
@@ -349,82 +231,6 @@ function UserLoginManual() {
</Typography>
</Paper>
)}
<Dialog open={Boolean(quickConnectCode)} fullWidth maxWidth="xs">
<DialogContent
style={{
display: "flex",
flexDirection: "column",
alignItems: "center",
}}
>
<Typography
variant="h5"
mb={2}
style={{
width: "100%",
}}
>
Quick Connect Code:
</Typography>
<DialogContentText>
Use this code in the Quick Connect tab in your server to login.
</DialogContentText>
<div
className="flex flex-row"
style={{ gap: "1em", alignItems: "center", marginTop: "1em" }}
>
<Tooltip title="Click to copy" arrow placement="top">
<Typography
variant="h3"
color="textPrimary"
textAlign="center"
sx={{
background: "rgb(255 255 255 / 0.1)",
width: "fit-content",
padding: "0.4em",
borderRadius: "10px",
cursor: "pointer",
}}
onClick={(e) => {
navigator.clipboard.writeText(quickConnectCode);
enqueueSnackbar("Quick Connect Code copied!", {
variant: "info",
key: "copiedText",
});
}}
>
{quickConnectCode}
</Typography>
</Tooltip>
</div>
</DialogContent>
<DialogActions
className="flex flex-row"
sx={{
padding: "0em 1em 1em 1em",
justifyContent: "space-between",
}}
>
<FormControlLabel
control={
<Checkbox
checked={rememberMe}
onChange={handleCheckRememberMe}
/>
}
label="Remember device"
/>
<Button
variant="contained"
onClick={() => {
setQuickConnectCode("");
setQuickConnectLoading(-1);
}}
>
Close
</Button>
</DialogActions>
</Dialog>
</div>
</>
);
+3 -2
View File
@@ -72,9 +72,10 @@ function ServerList() {
await servers.refetch();
if (servers.length > 1) {
setDefaultServer(servers[0].id);
createApi(servers[0].address, undefined);
setDefaultServer(servers.data?.[0].id);
createApi(servers.data?.[0].address, undefined);
} else {
await setDefaultServer(null);
// TODO: reset api in context here
}
queryClient.removeQueries();