Skip to content

Commit

Permalink
Allow Edge to edit local .js files
Browse files Browse the repository at this point in the history
Edge has blocked .user.js from being previewed in the browser.
Hence, we can rename the file extension to be .js (remove .user) to
ensure Edge display the script inside browser.
This partially solves #156, not perfectly.
  • Loading branch information
JingMatrix committed May 4, 2024
1 parent 9de7f62 commit 3652df9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/src/main/java/org/matrix/chromext/utils/Url.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ val invalidUserScriptUrls = mutableListOf<String>()

fun isUserScript(url: String?, path: String? = null): Boolean {
if (url == null) return false
if (url.endsWith(".user.js")) {
if (url.endsWith(".user.js") ||
(Chrome.isEdge && url.endsWith(".js") && url.startsWith("file://"))) {
if (invalidUserScriptUrls.contains(url)) return false
invalidUserScriptDomains.forEach { if (url.startsWith("https://" + it) == true) return false }
return true
Expand Down

0 comments on commit 3652df9

Please sign in to comment.