Merge pull request #10682 from jumpserver/pr@dev@allow_chrome_some_shortcut

perf: 放行快捷键 ctrl-c-v
pull/10689/head
老广 1 year ago committed by GitHub
commit 1b750cf51d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,6 +13,7 @@ __all__ = [
] ]
from orgs.utils import tmp_to_root_org from orgs.utils import tmp_to_root_org
from orgs.utils import tmp_to_org
class ActionChoices(models.TextChoices): class ActionChoices(models.TextChoices):
@ -116,6 +117,7 @@ class UserAssetAccountBaseACL(OrgModelMixin, UserBaseACL):
queryset = queryset.filter(q) queryset = queryset.filter(q)
if asset: if asset:
org_id = asset.org_id org_id = asset.org_id
with tmp_to_org(org_id):
q = cls.assets.get_filter_q(asset) q = cls.assets.get_filter_q(asset)
queryset = queryset.filter(q) queryset = queryset.filter(q)
if account and not account_username: if account and not account_username:

@ -40,9 +40,9 @@ document.addEventListener("contextmenu", function (event) {
event.preventDefault(); event.preventDefault();
}); });
var AllowedKeys = ['P', 'F', 'p', 'f'] var AllowedKeys = ['P', 'F', 'C', 'V']
window.addEventListener("keydown", function (e) { window.addEventListener("keydown", function (e) {
if (e.key === "F12" || (e.ctrlKey && !AllowedKeys.includes(e.key))) { if (e.key === "F12" || (e.ctrlKey && !AllowedKeys.includes(e.key.toUpperCase()))) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
console.log('Press key: ', e.ctrlKey ? 'Ctrl' : '', e.shiftKey ? ' Shift' : '', e.key) console.log('Press key: ', e.ctrlKey ? 'Ctrl' : '', e.shiftKey ? ' Shift' : '', e.key)

Loading…
Cancel
Save