Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Petra Mirelli
UntrackMe
Commits
a7358ee1
Commit
a7358ee1
authored
Oct 25, 2021
by
Thomas
Browse files
Support scribe.rip #63 - Handle subdomains to transform them into sribe.rip/@subdomain/......
parent
f931e157
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/src/fullLinks/AndroidManifest.xml
View file @
a7358ee1
...
...
@@ -118,6 +118,12 @@
<data
android:host=
"bibliogram.dsrev.ru"
/>
<data
android:host=
"bibliogram.pussthecat.org"
/>
<!-- MEDIUM URLs -->
<data
android:host=
"www.medium.com"
/>
<data
android:host=
"medium.com"
/>
<data
android:host=
"*.medium.com"
/>
<data
android:host=
"*"
/>
<data
android:pathPattern=
".*"
/>
<data
android:scheme=
"https"
/>
...
...
@@ -175,31 +181,16 @@
<data
android:host=
"i.redd.it"
/>
<data
android:host=
"preview.redd.it"
/>
<!-- MEDIUM URLs -->
<data
android:host=
"www.medium.com"
/>
<data
android:host=
"medium.com"
/>
<data
android:host=
"*.medium.com"
/>
<data
android:host=
"*"
/>
<data
android:mimeType=
"text/plain"
/>
</intent-filter>
<!-- MEDIUM URLs -->
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<data
android:host=
"medium.com"
/>
<data
android:pathPattern=
"/@.*"
/>
<data
android:scheme=
"https"
/>
<data
android:scheme=
"http"
/>
</intent-filter>
<!-- MEDIUM SHARING HANDLE -->
<intent-filter>
<action
android:name=
"android.intent.action.SEND"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
android:host=
"medium.com"
/>
<data
android:pathPattern=
"/@.*"
/>
<data
android:mimeType=
"text/plain"
/>
</intent-filter>
<!-- MAPS URLs -->
<!-- /maps/ -->
<intent-filter>
...
...
app/src/main/AndroidManifest.xml
View file @
a7358ee1
...
...
@@ -88,32 +88,16 @@
<data
android:host=
"i.redd.it"
/>
<data
android:host=
"preview.redd.it"
/>
<data
android:pathPattern=
".*"
/>
<data
android:scheme=
"https"
/>
<data
android:scheme=
"http"
/>
</intent-filter>
<!-- MEDIUM URLs -->
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<!-- MEDIUM URLs -->
<data
android:host=
"www.medium.com"
/>
<data
android:host=
"medium.com"
/>
<data
android:pathPattern=
"/@.*"
/>
<data
android:host=
"*.medium.com"
/>
<data
android:pathPattern=
".*"
/>
<data
android:scheme=
"https"
/>
<data
android:scheme=
"http"
/>
</intent-filter>
<!-- MEDIUM SHARING HANDLE -->
<intent-filter>
<action
android:name=
"android.intent.action.SEND"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
android:host=
"medium.com"
/>
<data
android:pathPattern=
"/@.*"
/>
<data
android:mimeType=
"text/plain"
/>
</intent-filter>
<!-- SHARING HANDLE -->
<intent-filter>
<action
android:name=
"android.intent.action.SEND"
/>
...
...
@@ -165,6 +149,11 @@
<data
android:host=
"i.redd.it"
/>
<data
android:host=
"preview.redd.it"
/>
<!-- MEDIUM URLs -->
<data
android:host=
"www.medium.com"
/>
<data
android:host=
"medium.com"
/>
<data
android:host=
"*.medium.com"
/>
<data
android:mimeType=
"text/plain"
/>
</intent-filter>
...
...
app/src/main/java/app/fedilab/nitterizeme/helpers/Utils.java
View file @
a7358ee1
...
...
@@ -108,6 +108,7 @@ public class Utils {
public
static
final
Pattern
nitterPattern
=
Pattern
.
compile
(
"(mobile\\.|www\\.)?twitter.com([\\w-/]+)"
);
public
static
final
Pattern
bibliogramPostPattern
=
Pattern
.
compile
(
"(m\\.|www\\.)?instagram.com(/p/[\\w-/]+)"
);
public
static
final
Pattern
scriberipPattern
=
Pattern
.
compile
(
"(www\\.)?medium.com/([\\w-/@]+)"
);
public
static
final
Pattern
scriberipSubdomainPattern
=
Pattern
.
compile
(
"([\\w_-]+)\\.medium.com/([\\w-/@]+)"
);
public
static
final
Pattern
bibliogramAccountPattern
=
Pattern
.
compile
(
"(m\\.|www\\.)?instagram.com(((?!/p/).)+)"
);
public
static
final
Pattern
maps
=
Pattern
.
compile
(
"/maps/place/([^@]+@)?([\\d.,z]+).*"
);
...
...
@@ -310,7 +311,7 @@ public class Utils {
}
else
{
return
url
;
}
}
else
if
(
Arrays
.
asList
(
medium_domains
).
contains
(
host
))
{
}
else
if
(
host
!=
null
&&
host
.
endsWith
(
medium_domains
[
0
]
))
{
boolean
scriberip_enabled
=
sharedpreferences
.
getBoolean
(
MainActivity
.
SET_SCRIBERIP_ENABLED
,
true
);
if
(
scriberip_enabled
)
{
String
scriberipHost
=
sharedpreferences
.
getString
(
MainActivity
.
SET_SCRIBERIP_HOST
,
MainActivity
.
DEFAULT_SCRIBERIP_HOST
);
...
...
@@ -319,7 +320,15 @@ public class Utils {
if
(
scriberipHost
.
startsWith
(
"http"
))
{
scheme
=
""
;
}
Matcher
matcher
=
scriberipPattern
.
matcher
(
url
);
Matcher
matcher
=
scriberipSubdomainPattern
.
matcher
(
url
);
while
(
matcher
.
find
())
{
final
String
subdomain
=
matcher
.
group
(
1
);
final
String
path
=
matcher
.
group
(
2
);
if
(
subdomain
!=
null
&&
subdomain
.
toLowerCase
().
compareTo
(
"www"
)
!=
0
)
{
url
=
scheme
+
"medium.com"
+
"/@"
+
subdomain
+
"/"
+
path
;
}
}
matcher
=
scriberipPattern
.
matcher
(
url
);
while
(
matcher
.
find
())
{
final
String
scriberip_directory
=
matcher
.
group
(
2
);
newUrl
=
scheme
+
scriberipHost
+
"/"
+
scriberip_directory
;
...
...
@@ -1218,7 +1227,7 @@ public class Utils {
return
Arrays
.
asList
(
twitter_domains
).
contains
(
host
)
||
Arrays
.
asList
(
nitter_instances
).
contains
(
host
)
||
Arrays
.
asList
(
reddit_domains
).
contains
(
host
)
||
Arrays
.
asList
(
instagram_domains
).
contains
(
host
)
||
Arrays
.
asList
(
bibliogram_instances
).
contains
(
host
)
||
url
.
contains
(
"/maps/place"
)
||
url
.
contains
(
"/amp/s/"
)
||
(
host
!=
null
&&
host
.
contains
(
outlook_safe_domain
))
||
Arrays
.
asList
(
youtube_domains
).
contains
(
host
)
||
Arrays
.
asList
(
invidious_instances
).
contains
(
host
)
||
Arrays
.
asList
(
medium_domains
).
contains
(
host
);
||
Arrays
.
asList
(
youtube_domains
).
contains
(
host
)
||
Arrays
.
asList
(
invidious_instances
).
contains
(
host
)
||
(
host
!=
null
&&
host
.
endsWith
(
medium_domains
[
0
])
);
}
public
static
boolean
routerEnabledForHost
(
Context
context
,
String
url
)
{
...
...
@@ -1242,7 +1251,7 @@ public class Utils {
return
sharedpreferences
.
getBoolean
(
SET_INVIDIOUS_ENABLED
,
true
);
}
else
if
(
Arrays
.
asList
(
reddit_domains
).
contains
(
host
))
{
return
sharedpreferences
.
getBoolean
(
SET_TEDDIT_ENABLED
,
true
);
}
else
if
(
Arrays
.
asList
(
medium_domains
).
contains
(
host
))
{
}
else
if
(
host
!=
null
&&
host
.
endsWith
(
medium_domains
[
0
]
))
{
return
sharedpreferences
.
getBoolean
(
SET_SCRIBERIP_ENABLED
,
true
);
}
else
return
url
.
contains
(
"/amp/s/"
)
||
(
host
!=
null
&&
host
.
contains
(
outlook_safe_domain
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment