Skip to content

Commit

Permalink
Add feature syncing user scripts with local files via WebDAV server
Browse files Browse the repository at this point in the history
to be able to use external editor.

Resolves greasemonkey#2513 , resolves greasemonkey#2932 , resolves greasemonkey#3048 .
  • Loading branch information
esperecyan committed Jun 15, 2022
1 parent a571b9f commit 2b965b0
Show file tree
Hide file tree
Showing 14 changed files with 999 additions and 9 deletions.
24 changes: 24 additions & 0 deletions _locales/en/messages.json
Expand Up @@ -87,6 +87,9 @@
"fix_and_save": {
"message": "The editor contents have not been saved. Fix this error and try again."
},
"fix_and_save_sync_via_webdav": {
"message": "The modified user JS file have not been synced. Fix this error and try again."
},
"get_user_scripts": {
"message": "Get user scripts"
},
Expand Down Expand Up @@ -285,5 +288,26 @@
},
"use_enhanced_editor_explain": {
"message": "Screen reader users should disable this, as the enhanced code editor is not accessible."
},
"sync_via_webdav": {
"message": "Sync Local Files via WebDAV"
},
"sync_via_webdav_is_enabled": {
"message": "Sync Enabled"
},
"sync_via_webdav_is_disabled": {
"message": "Sync Disabled"
},
"sync_via_webdav_url": {
"message": "WebDAV Directory URL"
},
"sync_via_webdav_url_pattern_description": {
"message": "Enter a URL that begins with \"http://localhost\", contains a non-empty path, and ends with \"/\"."
},
"sync_via_webdav_description": {
"message": "The WebDAV server must allow PROPFIND GET MKCOL PUT DELETE methods and depth: infinity."
},
"sync_via_webdav_error_notification_title": {
"message": "Greasemonkey Sync via WebDAV Error"
}
}
23 changes: 23 additions & 0 deletions doc/Messages.md
Expand Up @@ -168,6 +168,29 @@ Request data:

* `excludes` A string, one `@exclude` pattern per line.

# SyncViaWebdavChangeOption
Sent by: `browser/monkey-menu.js`
Received by: `bg/sync-via-webdav.js`

Triggered when "Sync via WebDAV" options on the popup menu is changed by the user.
Enables, Disabled, or Reenables the sync.

Data:

Either of the following

* `enabled` boolean, the new status (true = enabled, false = disabled).
* `url` string, WebDAV directory URL.

If neither is specified, just gets "Sync via WebDAV" options.

Response data:

Ppresented upon async completion.

* `enabled` boolean, the new status (true = enabled, false = disabled).
* `url` string, WebDAV directory URL.

# UserScriptGet
Sent by: `content/edit-user-script.js`

Expand Down
2 changes: 2 additions & 0 deletions manifest.json
Expand Up @@ -38,6 +38,7 @@
"/src/bg/on-user-script-open-in-tab.js",
"/src/bg/on-user-script-xhr.js",
"/src/bg/options.js",
"/src/bg/sync-via-webdav.js",
"/src/bg/user-script-detect.js",
"/src/bg/user-script-registry.js",
"/src/bg/updater.js",
Expand All @@ -59,6 +60,7 @@
"/third-party/webdav/webdav.js",

"/src/bg/execute.run.js",
"/src/bg/sync-via-webdav.run.js",
"/src/bg/user-script-detect.run.js",
"/src/bg/user-script-registry.run.js"
]
Expand Down
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -2,7 +2,7 @@
"name": "Greasemonkey",
"version": "0.0.1",
"scripts": {
"test": "karma start karma.conf.js"
"test": "node test/test.js"
},
"devDependencies": {
"chai": "^4.1.2",
Expand All @@ -16,6 +16,7 @@
"mocha": "^3.1.2",
"sinon": "^4.1.5",
"sinon-chrome": "^2.2.1",
"tinybind": "^0.11.0"
"tinybind": "^0.11.0",
"webdav-server": "^2.6.2"
}
}

0 comments on commit 2b965b0

Please sign in to comment.