Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
stokito committed Mar 5, 2023
1 parent cb19c88 commit 04db777
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
# webdav-browser-extension
Chrome extension to browse a URL as a WebDAV share
Chrome extension to browse a URL as a WebDAV share.

It just uses the https://github.com/dom111/webdav-js
But instead of a bookmarklet you can use it as an extension.

## TODO and known problems
* You need a dir listing enabled otherwise it will fail due to a bug https://github.com/dom111/webdav-js/issues/123
* Remember folders that should be viewed as dav
* Use a state as for Dark Reader or tutorial.focus-mode. The current popup solution is lame.
* Autodetect a webdav share:
* On 403 error we can try a PROPFIND
* `Alt-Svc: dav` header https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Alt-Svc
* Option to load the webdav-js directly from CDN with a latest version

Binary file added icons8-dav-50px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "WebDAV Browser",
"description": "Browse a URL as a WebDAV share",
"version": "1.0",
"manifest_version": 3,
"icons": {
"48": "icons8-dav-50px.png"
},
"permissions": [
"activeTab",
"scripting"
],
"host_permissions": [
"http://*/*",
"https://*/*"
],
"action": {
"default_popup": "popup.html",
"default_icon": "icons8-dav-50px.png"
}
}
3 changes: 3 additions & 0 deletions popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<html>
<script src="popup.js"></script>
</html>
29 changes: 29 additions & 0 deletions popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
chrome.tabs.query({
currentWindow: true,
active: true
}, (tabs) => {
if (tabs.length !== 1) {
return
}
insertWebdavJs(tabs[0])
})

function insertWebdavJs(tab) {
chrome.scripting.executeScript({
target: {tabId: tab.id},
func: clearBody,
})
chrome.scripting.executeScript({
target: {tabId: tab.id},
files: ['webdav-min.js']
})
chrome.scripting.insertCSS({
target: {tabId: tab.id},
files: ['style-min.css'],
})
}

function clearBody(){
console.log("Clear existing body if any")
document.body.innerHTML = ""
}
2 changes: 2 additions & 0 deletions style-min.css

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions webdav-min.js

Large diffs are not rendered by default.

0 comments on commit 04db777

Please sign in to comment.