cmdbox 0.5.0.7__py3-none-any.whl → 0.5.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cmdbox might be problematic. Click here for more details.
- cmdbox/app/edge.py +96 -12
- cmdbox/app/features/cli/cmdbox_edge_config.py +9 -3
- cmdbox/app/features/cli/cmdbox_gui_start.py +1 -1
- cmdbox/app/features/cli/cmdbox_web_start.py +2 -1
- cmdbox/app/features/web/cmdbox_web_bbforce_cmd.py +1 -1
- cmdbox/app/features/web/cmdbox_web_copyright.py +1 -1
- cmdbox/app/features/web/cmdbox_web_del_cmd.py +1 -1
- cmdbox/app/features/web/cmdbox_web_del_pipe.py +1 -1
- cmdbox/app/features/web/cmdbox_web_do_signin.py +88 -32
- cmdbox/app/features/web/cmdbox_web_exec_cmd.py +2 -2
- cmdbox/app/features/web/cmdbox_web_exec_pipe.py +2 -2
- cmdbox/app/features/web/cmdbox_web_filer download.py +2 -3
- cmdbox/app/features/web/cmdbox_web_filer.py +1 -1
- cmdbox/app/features/web/cmdbox_web_filer_upload.py +1 -1
- cmdbox/app/features/web/cmdbox_web_get_cmd_choices.py +1 -1
- cmdbox/app/features/web/cmdbox_web_get_cmds.py +2 -2
- cmdbox/app/features/web/cmdbox_web_get_modes.py +2 -2
- cmdbox/app/features/web/cmdbox_web_get_server_opt.py +1 -1
- cmdbox/app/features/web/cmdbox_web_gui.py +2 -2
- cmdbox/app/features/web/cmdbox_web_list_cmd.py +2 -2
- cmdbox/app/features/web/cmdbox_web_list_pipe.py +2 -2
- cmdbox/app/features/web/cmdbox_web_load_cmd.py +1 -1
- cmdbox/app/features/web/cmdbox_web_load_pin.py +3 -5
- cmdbox/app/features/web/cmdbox_web_load_pipe.py +1 -1
- cmdbox/app/features/web/cmdbox_web_raw_cmd.py +1 -1
- cmdbox/app/features/web/cmdbox_web_raw_pipe.py +1 -1
- cmdbox/app/features/web/cmdbox_web_result.py +2 -2
- cmdbox/app/features/web/cmdbox_web_save_cmd.py +1 -1
- cmdbox/app/features/web/cmdbox_web_save_pin.py +2 -2
- cmdbox/app/features/web/cmdbox_web_save_pipe.py +1 -1
- cmdbox/app/features/web/cmdbox_web_signin.py +26 -8
- cmdbox/app/features/web/cmdbox_web_users.py +35 -37
- cmdbox/app/features/web/cmdbox_web_versions_cmdbox.py +1 -1
- cmdbox/app/features/web/cmdbox_web_versions_used.py +1 -1
- cmdbox/app/options.py +8 -8
- cmdbox/app/web.py +76 -555
- cmdbox/extensions/sample_project/sample/extensions/features.yml +38 -13
- cmdbox/extensions/sample_project/sample/extensions/user_list.yml +82 -40
- cmdbox/extensions/user_list.yml +10 -0
- cmdbox/version.py +2 -2
- cmdbox/web/assets/cmdbox/list_cmd.js +61 -6
- cmdbox/web/assets/cmdbox/signin.js +7 -0
- cmdbox/web/gui.html +12 -0
- cmdbox/web/signin.html +7 -0
- {cmdbox-0.5.0.7.dist-info → cmdbox-0.5.1.dist-info}/METADATA +1 -1
- {cmdbox-0.5.0.7.dist-info → cmdbox-0.5.1.dist-info}/RECORD +50 -51
- cmdbox/app/signin.py +0 -56
- {cmdbox-0.5.0.7.dist-info → cmdbox-0.5.1.dist-info}/LICENSE +0 -0
- {cmdbox-0.5.0.7.dist-info → cmdbox-0.5.1.dist-info}/WHEEL +0 -0
- {cmdbox-0.5.0.7.dist-info → cmdbox-0.5.1.dist-info}/entry_points.txt +0 -0
- {cmdbox-0.5.0.7.dist-info → cmdbox-0.5.1.dist-info}/top_level.txt +0 -0
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
features:
|
|
2
|
-
cli:
|
|
3
|
-
- package: sample.app.features.cli
|
|
4
|
-
prefix: sample_
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
cli: # Specify a list of package names in which the module implementing the command is located.
|
|
3
|
+
- package: sample.app.features.cli # Package Name. Classes inheriting from cmdbox.app.feature.Feature.
|
|
4
|
+
prefix: sample_ # Module name prefix. Modules that begin with this letter are eligible.
|
|
5
|
+
exclude_modules: [] # Specify the module name to exclude from the list of modules to be loaded.
|
|
6
|
+
web: # Specify a list of package names with modules that implement web screens and RESTAPIs.
|
|
7
|
+
- package: sample.app.features.web # Package Name. Classes inheriting from cmdbox.app.feature.WebFeature .
|
|
8
|
+
prefix: sample_web_ # Module name prefix. Modules that begin with this letter are eligible.
|
|
9
|
+
args: # Specifies default or forced arguments for the specified command.
|
|
10
|
+
cli: # Specify rules to apply default values or force arguments.
|
|
11
|
+
- rule: # Specify the rules for applying default values and forced arguments for each command line option.
|
|
12
|
+
mode: web # e.g. mode: web
|
|
13
|
+
default: # Specify a default value for each item to be set when a rule is matched.
|
|
14
|
+
# e.g. doc_root: f"{Path(self.ver.__file__).parent / 'web'}"
|
|
15
|
+
coercion: # Specify a coercion value for each item to be set when a rule is matched.
|
|
16
|
+
assets: # e.g. doc_root: f"{Path(self.ver.__file__).parent / 'web'}"
|
|
15
17
|
- f"{Path(self.ver.__file__).parent / 'web' / 'assets'}"
|
|
16
18
|
doc_root: f"{Path(self.ver.__file__).parent / 'web'}"
|
|
17
19
|
- rule:
|
|
@@ -21,3 +23,26 @@ args:
|
|
|
21
23
|
assets:
|
|
22
24
|
- f"{Path(self.ver.__file__).parent / 'web' / 'assets'}"
|
|
23
25
|
doc_root: f"{Path(self.ver.__file__).parent / 'web'}"
|
|
26
|
+
aliases: # Specify the alias for the specified command.
|
|
27
|
+
cli: # Specify the alias for the command line.
|
|
28
|
+
- source: # Specifies the command from which the alias originates.
|
|
29
|
+
mode: # Specify the mode of the source command. The exact match "mode" is selected.
|
|
30
|
+
# e.g. client
|
|
31
|
+
cmd: # Specify the source command to be aliased. The regex match "cmd" is selected.
|
|
32
|
+
# e.g. (.+)_(.+)
|
|
33
|
+
target: # Specifies the command to be aliased to.
|
|
34
|
+
mode: # Specify the mode of the target command. Create an alias for this “mode”.
|
|
35
|
+
# e.g. CLIENT
|
|
36
|
+
cmd: # Specify the target command to be aliased. Create an alias for this “cmd”, referring to the regular expression group of source by "{n}".
|
|
37
|
+
# e.g. {2}_{1}
|
|
38
|
+
move: # Specify whether to move the regular expression group of the source to the target.
|
|
39
|
+
# e.g. true
|
|
40
|
+
web: # Specify the alias for the RESTAPI.
|
|
41
|
+
- source: # Specifies the RESTAPI from which the alias originates.
|
|
42
|
+
path: # Specify the path of the source RESTAPI. The regex match "path" is selected.
|
|
43
|
+
# e.g. /exec_(.+)
|
|
44
|
+
target: # Specifies the RESTAPI to be aliased to.
|
|
45
|
+
path: # Specify the path of the target RESTAPI. Create an alias for this “path”, referring to the regular expression group of source by "{n}".
|
|
46
|
+
# e.g. /{1}_exec
|
|
47
|
+
move: # Specify whether to move the regular expression group of the source to the target.
|
|
48
|
+
# e.g. true
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
users:
|
|
2
|
-
- uid: 1
|
|
3
|
-
name: admin
|
|
4
|
-
password: admin
|
|
5
|
-
hash: plain
|
|
6
|
-
groups: [admin]
|
|
7
|
-
email: admin@aaa.bbb.jp
|
|
1
|
+
users: # A list of users, each of which is a map that contains the following fields.
|
|
2
|
+
- uid: 1 # An ID that identifies a user. No two users can have the same ID.
|
|
3
|
+
name: admin # A name that identifies the user. No two users can have the same name.
|
|
4
|
+
password: admin # The user's password. The value is hashed with the hash function specified in the next hash field.
|
|
5
|
+
hash: plain # The hash function used to hash the password, which can be plain, md5, sha1, or sha256, or oauth2.
|
|
6
|
+
groups: [admin] # A list of groups to which the user belongs, as specified in the groups field.
|
|
7
|
+
email: admin@aaa.bbb.jp # The email address of the user, used when authenticating using the provider specified in the oauth2 field.
|
|
8
8
|
- uid: 101
|
|
9
9
|
name: user01
|
|
10
10
|
password: b75705d7e35e7014521a46b532236ec3
|
|
@@ -23,42 +23,53 @@ users:
|
|
|
23
23
|
hash: sha256
|
|
24
24
|
groups: [editor]
|
|
25
25
|
email: user03@aaa.bbb.jp
|
|
26
|
-
groups:
|
|
27
|
-
- gid: 1
|
|
28
|
-
name: admin
|
|
26
|
+
groups: # A list of groups, each of which is a map that contains the following fields.
|
|
27
|
+
- gid: 1 # An ID that identifies a group. No two groups can have the same ID.
|
|
28
|
+
name: admin # A name that identifies the group. No two groups can have the same name.
|
|
29
|
+
- gid: 2
|
|
30
|
+
name: guest
|
|
29
31
|
- gid: 101
|
|
30
32
|
name: user
|
|
31
33
|
- gid: 102
|
|
32
34
|
name: readonly
|
|
33
|
-
parent: user
|
|
35
|
+
parent: user # The parent group of the group. If the parent group is not specified, the group is a top-level group.
|
|
34
36
|
- gid: 103
|
|
35
37
|
name: editor
|
|
36
38
|
parent: user
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
|
|
40
|
+
cmdrule: # A list of command rules, Specify a rule that determines whether or not a command is executable when executed by a user in web mode.
|
|
41
|
+
policy: deny # Specify the default policy for the rule. The value can be allow or deny.
|
|
42
|
+
rules: # Specify rules to allow or deny execution of the command, depending on the group the user belongs to.
|
|
40
43
|
- groups: [admin]
|
|
41
44
|
rule: allow
|
|
42
|
-
- groups: [user]
|
|
43
|
-
mode: client
|
|
44
|
-
cmds: [file_download, file_list, server_info]
|
|
45
|
-
rule: allow
|
|
45
|
+
- groups: [user] # Specify the groups to which the rule applies.
|
|
46
|
+
mode: client # Specify the "mode" as the condition for applying the rule.
|
|
47
|
+
cmds: [file_download, file_list, server_info] # Specify the "cmd" to which the rule applies. Multiple items can be specified in a list.
|
|
48
|
+
rule: allow # Specifies whether or not the specified command is allowed for the specified group. The value can be allow or deny.
|
|
46
49
|
- groups: [user]
|
|
47
50
|
mode: server
|
|
48
51
|
cmds: [list]
|
|
49
52
|
rule: allow
|
|
53
|
+
- groups: [user, guest]
|
|
54
|
+
mode: web
|
|
55
|
+
cmds: [genpass]
|
|
56
|
+
rule: allow
|
|
50
57
|
- groups: [editor]
|
|
51
58
|
mode: client
|
|
52
59
|
cmds: [file_copy, file_mkdir, file_move, file_remove, file_rmdir, file_upload]
|
|
53
60
|
rule: allow
|
|
54
|
-
pathrule:
|
|
55
|
-
policy: deny
|
|
56
|
-
rules:
|
|
57
|
-
- groups: [admin]
|
|
58
|
-
paths: [/]
|
|
61
|
+
pathrule: # List of RESTAPI rules, rules that determine whether or not a RESTAPI can be executed when a user in web mode accesses it.
|
|
62
|
+
policy: deny # Specify the default policy for the rule. The value can be allow or deny.
|
|
63
|
+
rules: # Specify rules to allow or deny execution of the RESTAPI, depending on the group the user belongs to.
|
|
64
|
+
- groups: [admin] # Specify the groups to which the rule applies.
|
|
65
|
+
paths: [/] # Specify the "path" to which the rule applies. Multiple items can be specified in a list.
|
|
66
|
+
rule: allow # Specifies whether or not the specified RESTAPI is allowed for the specified group. The value can be allow or deny.
|
|
67
|
+
- groups: [guest]
|
|
68
|
+
paths: [/signin, /assets, /copyright, /dosignin, /dosignout, /password/change,
|
|
69
|
+
/gui, /get_server_opt, /usesignout, /versions_cmdbox, /versions_used]
|
|
59
70
|
rule: allow
|
|
60
71
|
- groups: [user]
|
|
61
|
-
paths: [/signin, /assets, /bbforce_cmd, /copyright, /dosignin, /dosignout,
|
|
72
|
+
paths: [/signin, /assets, /bbforce_cmd, /copyright, /dosignin, /dosignout, /password/change,
|
|
62
73
|
/exec_cmd, /exec_pipe, /filer, /gui, /get_server_opt, /usesignout, /versions_cmdbox, /versions_used]
|
|
63
74
|
rule: allow
|
|
64
75
|
- groups: [readonly]
|
|
@@ -67,21 +78,52 @@ pathrule:
|
|
|
67
78
|
- groups: [editor]
|
|
68
79
|
paths: [/gui/del_cmd, /gui/del_pipe, /gui/save_cmd, /gui/save_pipe]
|
|
69
80
|
rule: allow
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
password: # Password settings.
|
|
82
|
+
policy: # Password policy settings.
|
|
83
|
+
enabled: true # Specify whether or not to enable password policy.
|
|
84
|
+
not_same_before: true # Specify whether or not to allow the same password as the previous one.
|
|
85
|
+
min_length: 16 # Specify the minimum length of the password.
|
|
86
|
+
max_length: 64 # Specify the maximum length of the password.
|
|
87
|
+
min_lowercase: 1 # Specify the minimum number of lowercase letters in the password.
|
|
88
|
+
min_uppercase: 1 # Specify the minimum number of uppercase letters in the password.
|
|
89
|
+
min_digit: 1 # Specify the minimum number of digits in the password.
|
|
90
|
+
min_symbol: 1 # Specify the minimum number of symbol characters in the password.
|
|
91
|
+
not_contain_username: true # Specify whether or not to include the username in the password.
|
|
92
|
+
expiration: # Password expiration settings.
|
|
93
|
+
enabled: true # Specify whether or not to enable password expiration.
|
|
94
|
+
period: 90 # Specify the number of days after which the password will expire.
|
|
95
|
+
notify: 7 # Specify the number of days before the password expires that a notification will be sent.
|
|
96
|
+
lockout: # Account lockout settings.
|
|
97
|
+
enabled: true # Specify whether or not to enable account lockout.
|
|
98
|
+
threshold: 5 # Specify the number of failed login attempts before the account is locked.
|
|
99
|
+
reset: 30 # Specify the number of minutes after which the failed login count will be reset.
|
|
100
|
+
oauth2: # OAuth2 settings.
|
|
101
|
+
providers: # This is a per-provider setting for OAuth2.
|
|
102
|
+
google: # Google's OAuth2 configuration.
|
|
103
|
+
enabled: false # Specify whether to enable Google's OAuth2.
|
|
104
|
+
client_id: XXXXXXXXXXX # Specify Google's OAuth2 client ID.
|
|
105
|
+
client_secret: XXXXXXXXXXX # Specify Google's OAuth2 client secret.
|
|
106
|
+
redirect_uri: https://localhost:8443/oauth2/google/callback # Specify Google's OAuth2 redirect URI.
|
|
107
|
+
scope: ['email'] # Specify the scope you want to retrieve with Google's OAuth2. Usually, just reading the email is sufficient.
|
|
108
|
+
signin_module: # Specify the module name that implements the sign-in. see, cmdbox.app.signin.SignIn
|
|
109
|
+
note: # Specify a description such as Google's OAuth2 reference site.
|
|
79
110
|
- https://developers.google.com/identity/protocols/oauth2/web-server?hl=ja#httprest
|
|
80
|
-
github:
|
|
81
|
-
enabled: false
|
|
82
|
-
client_id: XXXXXXXXXXX
|
|
83
|
-
client_secret: XXXXXXXXXXX
|
|
84
|
-
redirect_uri: https://localhost:8443/oauth2/github/callback
|
|
85
|
-
scope: ['user:email']
|
|
86
|
-
|
|
111
|
+
github: # OAuth2 settings for GitHub.
|
|
112
|
+
enabled: false # Specify whether to enable OAuth2 for GitHub.
|
|
113
|
+
client_id: XXXXXXXXXXX # Specify the OAuth2 client ID for GitHub.
|
|
114
|
+
client_secret: XXXXXXXXXXX # Specify the GitHub OAuth2 client secret.
|
|
115
|
+
redirect_uri: https://localhost:8443/oauth2/github/callback # Specify the OAuth2 redirect URI for GitHub.
|
|
116
|
+
scope: ['user:email'] # Specify the scope you want to get from GitHub's OAuth2. Usually, just reading the email is sufficient.
|
|
117
|
+
signin_module: # Specify the module name that implements the sign-in. see, cmdbox.app.signin.SignIn
|
|
118
|
+
note: # Specify a description, such as a reference site for OAuth2 on GitHub.
|
|
87
119
|
- https://docs.github.com/ja/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#scopes
|
|
120
|
+
azure: # OAuth2 settings for Azure AD.
|
|
121
|
+
enabled: false # Specify whether to enable OAuth2 for Azure AD.
|
|
122
|
+
tenant_id: XXXXXXXXXXX # Specify the tenant ID for Azure AD.
|
|
123
|
+
client_id: XXXXXXXXXXX # Specify the OAuth2 client ID for Azure AD.
|
|
124
|
+
client_secret: XXXXXXXXXXX # Specify the Azure AD OAuth2 client secret.
|
|
125
|
+
redirect_uri: https://localhost:8443/oauth2/azure/callback # Specify the OAuth2 redirect URI for Azure AD.
|
|
126
|
+
scope: ['openid', 'profile', 'email', 'https://graph.microsoft.com/mail.read']
|
|
127
|
+
signin_module: # Specify the module name that implements the sign-in. see, cmdbox.app.signin.SignIn
|
|
128
|
+
note: # Specify a description, such as a reference site for Azure AD's OAuth2.
|
|
129
|
+
- https://learn.microsoft.com/ja-jp/entra/identity-platform/v2-oauth2-auth-code-flow
|
cmdbox/extensions/user_list.yml
CHANGED
|
@@ -116,3 +116,13 @@ oauth2: # OAuth2 settings.
|
|
|
116
116
|
signin_module: # Specify the module name that implements the sign-in. see, cmdbox.app.signin.SignIn
|
|
117
117
|
note: # Specify a description, such as a reference site for OAuth2 on GitHub.
|
|
118
118
|
- https://docs.github.com/ja/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#scopes
|
|
119
|
+
azure: # OAuth2 settings for Azure AD.
|
|
120
|
+
enabled: false # Specify whether to enable OAuth2 for Azure AD.
|
|
121
|
+
tenant_id: XXXXXXXXXXX # Specify the tenant ID for Azure AD.
|
|
122
|
+
client_id: XXXXXXXXXXX # Specify the OAuth2 client ID for Azure AD.
|
|
123
|
+
client_secret: XXXXXXXXXXX # Specify the Azure AD OAuth2 client secret.
|
|
124
|
+
redirect_uri: https://localhost:8443/oauth2/azure/callback # Specify the OAuth2 redirect URI for Azure AD.
|
|
125
|
+
scope: ['openid', 'profile', 'email', 'https://graph.microsoft.com/mail.read']
|
|
126
|
+
signin_module: # Specify the module name that implements the sign-in. see, cmdbox.app.signin.SignIn
|
|
127
|
+
note: # Specify a description, such as a reference site for Azure AD's OAuth2.
|
|
128
|
+
- https://learn.microsoft.com/ja-jp/entra/identity-platform/v2-oauth2-auth-code-flow
|
cmdbox/version.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
|
|
3
|
-
dt_now = datetime.datetime(2025, 3,
|
|
3
|
+
dt_now = datetime.datetime(2025, 3, 26)
|
|
4
4
|
__appid__ = 'cmdbox'
|
|
5
5
|
__title__ = 'cmdbox (Command Development Application)'
|
|
6
|
-
__version__ = '0.5.
|
|
6
|
+
__version__ = '0.5.1'
|
|
7
7
|
__copyright__ = f'Copyright © 2023-{dt_now.strftime("%Y")} hamacom2004jp'
|
|
8
8
|
__pypiurl__ = 'https://pypi.org/project/cmdbox/'
|
|
9
9
|
__srcurl__ = 'https://github.com/hamacom2004jp/cmdbox'
|
|
@@ -15,11 +15,58 @@ const list_cmd_func = async () => {
|
|
|
15
15
|
}
|
|
16
16
|
elem.find('.cmd_title').text(row.title);
|
|
17
17
|
elem.find('.cmd_mode').text(row.mode);
|
|
18
|
-
elem.find('.cmd_cmd').text(row.cmd)
|
|
18
|
+
elem.find('.cmd_cmd').text(row.cmd)
|
|
19
|
+
if (row.tag && Array.isArray(row.tag)) {
|
|
20
|
+
const tags = new Set([...row.tag]);
|
|
21
|
+
elem.find('.cmd_card').attr('data-tags', Array.from(tags).join(','));
|
|
22
|
+
}
|
|
19
23
|
$('#cmd_items').append(elem);
|
|
20
24
|
};
|
|
21
25
|
py_list_cmd.forEach(row => {card_func(row, true)});
|
|
22
26
|
py_list_cmd.forEach(row => {card_func(row, false)});
|
|
27
|
+
$('#cmd_item_tags').html('');
|
|
28
|
+
py_list_cmd.forEach(row => {
|
|
29
|
+
if (!row.tag || !Array.isArray(row.tag)) return;
|
|
30
|
+
const cmd_item_tags = $('#cmd_item_tags');
|
|
31
|
+
row.tag.forEach(tag => {
|
|
32
|
+
if (tag=='') return;
|
|
33
|
+
if (cmd_item_tags.find(`[data-tag="${tag}"]`).length > 0) return;
|
|
34
|
+
const elem = $(`<button type="button" class="btn btn-outline-secondary btn-sm btn-tag me-2">${tag}</button>`);
|
|
35
|
+
elem.attr('data-tag', tag);
|
|
36
|
+
elem.text(tag);
|
|
37
|
+
elem.click((e) => {
|
|
38
|
+
const ct = $(e.currentTarget);
|
|
39
|
+
const cmd_items = $('#cmd_items').find('.cmd_card:not(.cmd_add)');
|
|
40
|
+
if (ct.hasClass('btn-secondary')) {
|
|
41
|
+
ct.removeClass('btn-secondary');
|
|
42
|
+
ct.addClass('btn-outline-secondary');
|
|
43
|
+
}
|
|
44
|
+
else if (ct.hasClass('btn-outline-secondary')) {
|
|
45
|
+
ct.removeClass('btn-outline-secondary');
|
|
46
|
+
ct.addClass('btn-secondary');
|
|
47
|
+
}
|
|
48
|
+
const tags = new Set();
|
|
49
|
+
cmd_item_tags.find('.btn-tag').each((i, elem) => {
|
|
50
|
+
if ($(elem).hasClass('btn-secondary')) tags.add($(elem).attr('data-tag'));
|
|
51
|
+
});
|
|
52
|
+
if (tags.size == 0) {
|
|
53
|
+
cmd_items.parent().show();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
cmd_items.parent().hide();
|
|
57
|
+
tags.forEach(tag => {
|
|
58
|
+
cmd_items.each((i, elem) => {
|
|
59
|
+
const el = $(elem);
|
|
60
|
+
const itags = el.attr('data-tags');
|
|
61
|
+
if (!itags) return;
|
|
62
|
+
else if (itags.split(',').includes(tag)) el.parent().show();
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
cmd_item_tags.append(elem);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
});
|
|
23
70
|
}
|
|
24
71
|
// コマンドファイルの取得が出来た時の処理
|
|
25
72
|
const list_cmd_func_then = () => {
|
|
@@ -71,6 +118,7 @@ const list_cmd_func_then = () => {
|
|
|
71
118
|
const target_name = row.opt;
|
|
72
119
|
let input_elem, elem;
|
|
73
120
|
if(!row.choice) {
|
|
121
|
+
// 選択肢がない場合
|
|
74
122
|
if(row.type=='text') {
|
|
75
123
|
elem = $(cmd_modal.find('.row_content_template_text').html());
|
|
76
124
|
} else if(row.type=='dict') {
|
|
@@ -85,11 +133,16 @@ const list_cmd_func_then = () => {
|
|
|
85
133
|
input_elem.val(row.default);
|
|
86
134
|
}
|
|
87
135
|
else {
|
|
88
|
-
|
|
136
|
+
// 選択肢がある場合
|
|
137
|
+
if(row.type=='dict') {
|
|
138
|
+
elem = $(cmd_modal.find('.row_content_template_dict_choice').html());
|
|
139
|
+
} else {
|
|
140
|
+
elem = $(cmd_modal.find('.row_content_template_choice').html());
|
|
141
|
+
}
|
|
89
142
|
if (next_elem) next_elem.after(elem);
|
|
90
143
|
else row_content.append(elem);
|
|
91
|
-
input_elem = elem.find('.row_content_template_select');
|
|
92
|
-
input_elem.removeClass('row_content_template_select');
|
|
144
|
+
input_elem = elem.find('.row_content_template_select,.row_content_template_input');
|
|
145
|
+
input_elem.removeClass('row_content_template_select').removeClass('row_content_template_input');
|
|
93
146
|
if (row.choice_show) {
|
|
94
147
|
input_elem.addClass('choice_show');
|
|
95
148
|
input_elem.change(() => {
|
|
@@ -109,7 +162,7 @@ const list_cmd_func_then = () => {
|
|
|
109
162
|
});
|
|
110
163
|
}
|
|
111
164
|
input_elem.html(mkopt(row.choice));
|
|
112
|
-
input_elem.val(`${row.default}`);
|
|
165
|
+
input_elem.val(`${row.default!=null?row.default:''}`);
|
|
113
166
|
}
|
|
114
167
|
let index = 0;
|
|
115
168
|
if (cmd_modal.find(`[name="${target_name}"]`).length > 0) {
|
|
@@ -205,7 +258,8 @@ const list_cmd_func_then = () => {
|
|
|
205
258
|
}
|
|
206
259
|
title.append(`<span>${row.opt}</span>`);
|
|
207
260
|
if (row.hide) {
|
|
208
|
-
|
|
261
|
+
if (row_content.find('.row_content_hide').is(':hidden')) elem.hide();
|
|
262
|
+
elem.addClass('row_content_hide');
|
|
209
263
|
} else {
|
|
210
264
|
title.addClass('text-decoration-underline');
|
|
211
265
|
}
|
|
@@ -478,6 +532,7 @@ const get_param = (modal_elem) => {
|
|
|
478
532
|
$(elem).addClass('is-valid');
|
|
479
533
|
}
|
|
480
534
|
} else if (data_type=='dict') {
|
|
535
|
+
data_val = data_val ? data_val : '';
|
|
481
536
|
if(data_val.indexOf(' ')>=0) $(elem).addClass('is-invalid');
|
|
482
537
|
else {
|
|
483
538
|
$(elem).removeClass('is-invalid');
|
|
@@ -58,6 +58,7 @@ $(() => {
|
|
|
58
58
|
});
|
|
59
59
|
const btn_google = $('.btn-google');
|
|
60
60
|
const btn_github = $('.btn-github');
|
|
61
|
+
const btn_azure = $('.btn-azure');
|
|
61
62
|
btn_google.off('click').on('click', async (event) => {
|
|
62
63
|
const path = window.location.pathname.replace('/signin', '');
|
|
63
64
|
window.location.href = `../oauth2/google${path}?n=${cmdbox.randam_string(8)}`;
|
|
@@ -66,11 +67,17 @@ $(() => {
|
|
|
66
67
|
const path = window.location.pathname.replace('/signin', '');
|
|
67
68
|
window.location.href = `../oauth2/github${path}?n=${cmdbox.randam_string(8)}`;
|
|
68
69
|
});
|
|
70
|
+
btn_azure.off('click').on('click', async (event) => {
|
|
71
|
+
const path = window.location.pathname.replace('/signin', '');
|
|
72
|
+
window.location.href = `../oauth2/azure${path}?n=${cmdbox.randam_string(8)}`;
|
|
73
|
+
});
|
|
69
74
|
oauth2_enabled().then((res) => {
|
|
70
75
|
if (res.google) btn_google.show();
|
|
71
76
|
else btn_google.hide();
|
|
72
77
|
if (res.github) btn_github.show();
|
|
73
78
|
else btn_github.hide();
|
|
79
|
+
if (res.azure) btn_azure.show();
|
|
80
|
+
else btn_azure.hide();
|
|
74
81
|
});
|
|
75
82
|
});
|
|
76
83
|
const get_client_data = async () => {
|
cmdbox/web/gui.html
CHANGED
|
@@ -113,6 +113,7 @@
|
|
|
113
113
|
Commands :
|
|
114
114
|
<input id="cmd_kwd" name="cmd_kwd" type="text" class="form-control d-inline-block" style="width:200px;" placeholder="Search title">
|
|
115
115
|
</h2>
|
|
116
|
+
<div id="cmd_item_tags" class="mb-2"></div>
|
|
116
117
|
<div id="cmd_items" class="row">
|
|
117
118
|
</div>
|
|
118
119
|
<div class="d-none">
|
|
@@ -251,6 +252,17 @@
|
|
|
251
252
|
</div>
|
|
252
253
|
</div>
|
|
253
254
|
</div>
|
|
255
|
+
<div class="row d-none row_content_template_dict_choice">
|
|
256
|
+
<div class="col-12 mb-3">
|
|
257
|
+
<div class="input-group">
|
|
258
|
+
<label class="input-group-text row_content_template_title">title</label>
|
|
259
|
+
<input type="text" class="form-control row_content_key row_content_template_input">
|
|
260
|
+
<label class="input-group-text">=</label>
|
|
261
|
+
<select class="form-select row_content_template_select">
|
|
262
|
+
</select>
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
254
266
|
<div class="row d-none row_content_template_choice">
|
|
255
267
|
<div class="col-6 mb-3">
|
|
256
268
|
<div class="input-group">
|
cmdbox/web/signin.html
CHANGED
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
<symbol id="github" viewBox="0 0 16 16">
|
|
31
31
|
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8"/>
|
|
32
32
|
</symbol>
|
|
33
|
+
<symbol id="azure" viewBox="0 0 16 16">
|
|
34
|
+
<path d="M7.462 0H0v7.19h7.462zM16 0H8.538v7.19H16zM7.462 8.211H0V16h7.462zm8.538 0H8.538V16H16z"/>
|
|
35
|
+
</symbol>
|
|
33
36
|
<symbol id="svg_eye_btn" viewBox="0 0 16 16">
|
|
34
37
|
<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8M1.173 8a13 13 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5s3.879 1.168 5.168 2.457A13 13 0 0 1 14.828 8q-.086.13-.195.288c-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5s-3.879-1.168-5.168-2.457A13 13 0 0 1 1.172 8z"/>
|
|
35
38
|
<path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0"/>
|
|
@@ -91,6 +94,10 @@
|
|
|
91
94
|
</div>
|
|
92
95
|
<button class="btn btn-primary w-100 py-2" type="submit">Sign in</button>
|
|
93
96
|
<div class="mt-3">
|
|
97
|
+
<button class="btn btn-outline-primary w-100 py-2 mb-3 btn-azure" type="button" style="display:none;">
|
|
98
|
+
<svg class="bi my-1 theme-icon-active" fill="currentColor" width="16" height="16"><use href="#azure"></use></svg>
|
|
99
|
+
Sign in with Microsoft
|
|
100
|
+
</button>
|
|
94
101
|
<button class="btn btn-outline-primary w-100 py-2 mb-3 btn-google" type="button" style="display:none;">
|
|
95
102
|
<svg class="bi my-1 theme-icon-active" fill="currentColor" width="16" height="16"><use href="#google"></use></svg>
|
|
96
103
|
Sign in with Google
|