Added URL support
This commit is contained in:
@@ -25,6 +25,30 @@
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="materialious-auth" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter android:autoVerify="true">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="youtube.com"
|
||||
android:pathPrefix="/watch" />
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="www.youtube.com"
|
||||
android:pathPrefix="/watch" />
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="m.youtube.com"
|
||||
android:pathPrefix="/watch" />
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="youtu.be"
|
||||
android:pathPrefix="/watch" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<provider
|
||||
|
||||
@@ -86,15 +86,29 @@
|
||||
|
||||
// Auth response handling for Mobile
|
||||
App.addListener('appUrlOpen', (data) => {
|
||||
const authUrl = new URL(data.url);
|
||||
const username = authUrl.searchParams.get('username');
|
||||
const token = authUrl.searchParams.get('token');
|
||||
const url = new URL(data.url);
|
||||
|
||||
if (username && token) {
|
||||
authStore.set({
|
||||
username: username,
|
||||
token: token
|
||||
});
|
||||
if (data.url.includes('youtu')) {
|
||||
let videoId = url.searchParams.get('v');
|
||||
if (!videoId) {
|
||||
videoId = url.pathname.split('/')[1];
|
||||
}
|
||||
|
||||
if (!videoId) {
|
||||
return;
|
||||
}
|
||||
|
||||
goto(`/watch/${videoId}`);
|
||||
} else {
|
||||
const username = url.searchParams.get('username');
|
||||
const token = url.searchParams.get('token');
|
||||
|
||||
if (username && token) {
|
||||
authStore.set({
|
||||
username: username,
|
||||
token: token
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user