chook 1.1.5 → 1.1.9
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.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -0
- data/LICENSE.txt +5 -3
- data/bin/chook-server +7 -25
- data/data/chook.conf.example +24 -0
- data/data/sample_handlers/RestAPIOperation-executable +6 -24
- data/data/sample_handlers/RestAPIOperation.rb +6 -24
- data/data/sample_handlers/SmartGroupComputerMembershipChange-executable +6 -23
- data/data/sample_handlers/SmartGroupComputerMembershipChange.rb +6 -24
- data/lib/chook/configuration.rb +14 -26
- data/lib/chook/event/handled_event/handlers.rb +3 -21
- data/lib/chook/event/handled_event.rb +7 -24
- data/lib/chook/event/handled_event_logger.rb +6 -24
- data/lib/chook/event/test_event.rb +21 -30
- data/lib/chook/event.rb +6 -25
- data/lib/chook/event_handling.rb +6 -24
- data/lib/chook/event_testing.rb +6 -24
- data/lib/chook/foundation.rb +6 -24
- data/lib/chook/handled_events.rb +6 -24
- data/lib/chook/handled_subjects.rb +6 -24
- data/lib/chook/procs.rb +19 -27
- data/lib/chook/server/auth.rb +19 -26
- data/lib/chook/server/log.rb +11 -25
- data/lib/chook/server/public/css/chook.css +10 -0
- data/lib/chook/server/routes/handle_by_name.rb +7 -25
- data/lib/chook/server/routes/handle_webhook_event.rb +7 -25
- data/lib/chook/server/routes/handlers.rb +6 -24
- data/lib/chook/server/routes/home.rb +7 -27
- data/lib/chook/server/routes/log.rb +6 -24
- data/lib/chook/server/routes/login_logout.rb +6 -25
- data/lib/chook/server/routes.rb +11 -29
- data/lib/chook/server/views/layout.haml +32 -7
- data/lib/chook/server.rb +8 -24
- data/lib/chook/subject/computer.rb +14 -32
- data/lib/chook/subject/dep_device.rb +13 -31
- data/lib/chook/subject/handled_subject.rb +6 -24
- data/lib/chook/subject/jss.rb +10 -28
- data/lib/chook/subject/mobile_device.rb +12 -30
- data/lib/chook/subject/patch_software_title_update.rb +6 -24
- data/lib/chook/subject/policy_finished.rb +6 -24
- data/lib/chook/subject/push.rb +8 -26
- data/lib/chook/subject/rest_api_operation.rb +11 -29
- data/lib/chook/subject/scep_challenge.rb +6 -24
- data/lib/chook/subject/smart_group.rb +7 -25
- data/lib/chook/subject/test_subject.rb +23 -39
- data/lib/chook/subject.rb +6 -24
- data/lib/chook/test_events.rb +6 -24
- data/lib/chook/test_subjects.rb +6 -24
- data/lib/chook/version.rb +8 -27
- data/lib/chook.rb +6 -24
- metadata +11 -12
- data/lib/chook/server/public/imgs/ChookLogoAlMcWhiggin.png +0 -0
data/lib/chook/event_testing.rb
CHANGED
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
### Section 6. Trademarks. is deleted and replaced with:
|
|
8
|
-
###
|
|
9
|
-
### 6. Trademarks. This License does not grant permission to use the trade
|
|
10
|
-
### names, trademarks, service marks, or product names of the Licensor
|
|
11
|
-
### and its affiliates, except as required to comply with Section 4(c) of
|
|
12
|
-
### the License and to reproduce the content of the NOTICE file.
|
|
13
|
-
###
|
|
14
|
-
### You may obtain a copy of the Apache License at
|
|
15
|
-
###
|
|
16
|
-
### http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
###
|
|
18
|
-
### Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
### distributed under the Apache License with the above modification is
|
|
20
|
-
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
|
-
### KIND, either express or implied. See the Apache License for the specific
|
|
22
|
-
### language governing permissions and limitations under the Apache License.
|
|
23
|
-
###
|
|
24
|
-
###
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
25
7
|
# foundation
|
|
26
8
|
require 'chook/foundation'
|
|
27
9
|
|
data/lib/chook/foundation.rb
CHANGED
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
### Section 6. Trademarks. is deleted and replaced with:
|
|
8
|
-
###
|
|
9
|
-
### 6. Trademarks. This License does not grant permission to use the trade
|
|
10
|
-
### names, trademarks, service marks, or product names of the Licensor
|
|
11
|
-
### and its affiliates, except as required to comply with Section 4(c) of
|
|
12
|
-
### the License and to reproduce the content of the NOTICE file.
|
|
13
|
-
###
|
|
14
|
-
### You may obtain a copy of the Apache License at
|
|
15
|
-
###
|
|
16
|
-
### http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
###
|
|
18
|
-
### Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
### distributed under the Apache License with the above modification is
|
|
20
|
-
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
|
-
### KIND, either express or implied. See the Apache License for the specific
|
|
22
|
-
### language governing permissions and limitations under the Apache License.
|
|
23
|
-
###
|
|
24
|
-
###
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
25
7
|
|
|
26
8
|
# require the foundational files of chook
|
|
27
9
|
require 'json'
|
data/lib/chook/handled_events.rb
CHANGED
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
### Section 6. Trademarks. is deleted and replaced with:
|
|
8
|
-
###
|
|
9
|
-
### 6. Trademarks. This License does not grant permission to use the trade
|
|
10
|
-
### names, trademarks, service marks, or product names of the Licensor
|
|
11
|
-
### and its affiliates, except as required to comply with Section 4(c) of
|
|
12
|
-
### the License and to reproduce the content of the NOTICE file.
|
|
13
|
-
###
|
|
14
|
-
### You may obtain a copy of the Apache License at
|
|
15
|
-
###
|
|
16
|
-
### http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
###
|
|
18
|
-
### Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
### distributed under the Apache License with the above modification is
|
|
20
|
-
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
|
-
### KIND, either express or implied. See the Apache License for the specific
|
|
22
|
-
### language governing permissions and limitations under the Apache License.
|
|
23
|
-
###
|
|
24
|
-
###
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
25
7
|
|
|
26
8
|
module Chook
|
|
27
9
|
|
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
### Section 6. Trademarks. is deleted and replaced with:
|
|
8
|
-
###
|
|
9
|
-
### 6. Trademarks. This License does not grant permission to use the trade
|
|
10
|
-
### names, trademarks, service marks, or product names of the Licensor
|
|
11
|
-
### and its affiliates, except as required to comply with Section 4(c) of
|
|
12
|
-
### the License and to reproduce the content of the NOTICE file.
|
|
13
|
-
###
|
|
14
|
-
### You may obtain a copy of the Apache License at
|
|
15
|
-
###
|
|
16
|
-
### http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
###
|
|
18
|
-
### Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
### distributed under the Apache License with the above modification is
|
|
20
|
-
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
|
-
### KIND, either express or implied. See the Apache License for the specific
|
|
22
|
-
### language governing permissions and limitations under the Apache License.
|
|
23
|
-
###
|
|
24
|
-
###
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
25
7
|
|
|
26
8
|
module Chook
|
|
27
9
|
|
data/lib/chook/procs.rb
CHANGED
|
@@ -1,29 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
###
|
|
9
|
-
### 6. Trademarks. This License does not grant permission to use the trade
|
|
10
|
-
### names, trademarks, service marks, or product names of the Licensor
|
|
11
|
-
### and its affiliates, except as required to comply with Section 4(c) of
|
|
12
|
-
### the License and to reproduce the content of the NOTICE file.
|
|
13
|
-
###
|
|
14
|
-
### You may obtain a copy of the Apache License at
|
|
15
|
-
###
|
|
16
|
-
### http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
###
|
|
18
|
-
### Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
### distributed under the Apache License with the above modification is
|
|
20
|
-
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
|
-
### KIND, either express or implied. See the Apache License for the specific
|
|
22
|
-
### language governing permissions and limitations under the Apache License.
|
|
23
|
-
###
|
|
24
|
-
###
|
|
25
|
-
|
|
26
|
-
###
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
7
|
+
|
|
27
8
|
module Chook
|
|
28
9
|
|
|
29
10
|
# A namespace to hold Proc objects in constants
|
|
@@ -42,10 +23,21 @@ module Chook
|
|
|
42
23
|
level
|
|
43
24
|
else
|
|
44
25
|
lvl = Chook::Server::Log::LOG_LEVELS[level.to_sym]
|
|
45
|
-
lvl
|
|
26
|
+
lvl || Logger::UNKNOWN
|
|
46
27
|
end # if..else
|
|
47
28
|
end
|
|
48
29
|
|
|
30
|
+
COMMA_STRING_TO_ARRAY = proc { |val| val.split(/\s*,\s*/) }
|
|
31
|
+
|
|
32
|
+
ENV_FROM_CONFIG = proc do |envs|
|
|
33
|
+
envs = envs.split(/\s*,\s*/)
|
|
34
|
+
envs.each do |env|
|
|
35
|
+
var, val = env.split '='
|
|
36
|
+
ENV[var] = val
|
|
37
|
+
end
|
|
38
|
+
envs
|
|
39
|
+
end
|
|
40
|
+
|
|
49
41
|
MOBILE_USERID = proc { |_device| '-1' }
|
|
50
42
|
|
|
51
43
|
PRODUCT = proc { |_device| nil }
|
data/lib/chook/server/auth.rb
CHANGED
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
### Section 6. Trademarks. is deleted and replaced with:
|
|
8
|
-
###
|
|
9
|
-
### 6. Trademarks. This License does not grant permission to use the trade
|
|
10
|
-
### names, trademarks, service marks, or product names of the Licensor
|
|
11
|
-
### and its affiliates, except as required to comply with Section 4(c) of
|
|
12
|
-
### the License and to reproduce the content of the NOTICE file.
|
|
13
|
-
###
|
|
14
|
-
### You may obtain a copy of the Apache License at
|
|
15
|
-
###
|
|
16
|
-
### http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
###
|
|
18
|
-
### Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
### distributed under the Apache License with the above modification is
|
|
20
|
-
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
|
-
### KIND, either express or implied. See the Apache License for the specific
|
|
22
|
-
### language governing permissions and limitations under the Apache License.
|
|
23
|
-
###
|
|
24
|
-
###
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
25
7
|
|
|
26
8
|
module Chook
|
|
27
9
|
|
|
@@ -37,6 +19,7 @@ module Chook
|
|
|
37
19
|
# don't protect if user isn't defined
|
|
38
20
|
return unless Chook.config.webhooks_user
|
|
39
21
|
return if webhook_user_authorized?
|
|
22
|
+
|
|
40
23
|
headers['WWW-Authenticate'] = 'Basic realm="Restricted Area"'
|
|
41
24
|
halt 401, "Not authorized\n"
|
|
42
25
|
end
|
|
@@ -67,6 +50,7 @@ module Chook
|
|
|
67
50
|
# admin user auth might come from config, might come from Jamf Pro
|
|
68
51
|
def authenticate_admin(user, pw)
|
|
69
52
|
return authenticate_jamf_admin(user, pw) if Chook.config.admin_user == USE_JAMF_ADMIN_USER
|
|
53
|
+
|
|
70
54
|
authenticate_admin_user(user, pw)
|
|
71
55
|
end
|
|
72
56
|
|
|
@@ -94,6 +78,13 @@ module Chook
|
|
|
94
78
|
use_ssl: Chook.config.jamf_use_ssl,
|
|
95
79
|
verify_cert: Chook.config.jamf_verify_cert
|
|
96
80
|
)
|
|
81
|
+
|
|
82
|
+
if Chook.config.jamf_admins && !Chook.config.jamf_admins.include?(user)
|
|
83
|
+
Chook.logger.warn "Jamf Admin login FAILED for: #{user}@#{request.ip}, Not listed in config.jamf_admins"
|
|
84
|
+
session[:authed_admin] = nil
|
|
85
|
+
return false
|
|
86
|
+
end
|
|
87
|
+
|
|
97
88
|
Chook.logger.debug "Jamf Admin login for: #{user}@#{request.ip}"
|
|
98
89
|
|
|
99
90
|
session[:authed_admin] = user
|
|
@@ -138,22 +129,24 @@ module Chook
|
|
|
138
129
|
def self.pw_from_command(cmd)
|
|
139
130
|
cmd = cmd.chomp '|'
|
|
140
131
|
output = `#{cmd} 2>&1`.chomp
|
|
141
|
-
raise "Can't get password from #{
|
|
132
|
+
raise "Can't get password from #{cmd}: #{output}" unless $CHILD_STATUS.exitstatus.zero?
|
|
133
|
+
|
|
142
134
|
output
|
|
143
135
|
end
|
|
144
136
|
|
|
145
137
|
def self.pw_from_file(file)
|
|
146
138
|
file = Pathname.new file
|
|
147
139
|
return nil unless file.file?
|
|
140
|
+
|
|
148
141
|
stat = file.stat
|
|
149
142
|
mode = format('%o', stat.mode)
|
|
150
143
|
raise "Password file #{setting} has insecure mode, must be 0600." unless mode.end_with?('0600')
|
|
151
144
|
raise "Password file #{setting} has insecure owner, must be owned by UID #{Process.euid}." unless stat.owned?
|
|
145
|
+
|
|
152
146
|
# chomping an empty string removes all trailing \n's and \r\n's
|
|
153
147
|
file.read.chomp('')
|
|
154
148
|
end
|
|
155
149
|
|
|
156
|
-
|
|
157
150
|
end # server
|
|
158
151
|
|
|
159
152
|
end # Chook
|
data/lib/chook/server/log.rb
CHANGED
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
### Section 6. Trademarks. is deleted and replaced with:
|
|
8
|
-
###
|
|
9
|
-
### 6. Trademarks. This License does not grant permission to use the trade
|
|
10
|
-
### names, trademarks, service marks, or product names of the Licensor
|
|
11
|
-
### and its affiliates, except as required to comply with Section 4(c) of
|
|
12
|
-
### the License and to reproduce the content of the NOTICE file.
|
|
13
|
-
###
|
|
14
|
-
### You may obtain a copy of the Apache License at
|
|
15
|
-
###
|
|
16
|
-
### http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
###
|
|
18
|
-
### Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
### distributed under the Apache License with the above modification is
|
|
20
|
-
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
|
-
### KIND, either express or implied. See the Apache License for the specific
|
|
22
|
-
### language governing permissions and limitations under the Apache License.
|
|
23
|
-
###
|
|
24
|
-
###
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
25
7
|
|
|
26
8
|
# the main module
|
|
27
9
|
module Chook
|
|
@@ -92,6 +74,7 @@ module Chook
|
|
|
92
74
|
active_stream << "#{LOGSTREAM_DATA_PFX}#{str}\n\n"
|
|
93
75
|
end
|
|
94
76
|
end
|
|
77
|
+
|
|
95
78
|
end # class
|
|
96
79
|
|
|
97
80
|
# mapping of integer levels to symbols
|
|
@@ -138,7 +121,7 @@ module Chook
|
|
|
138
121
|
Logger.new(
|
|
139
122
|
LogFileWithStream.new(Chook.config.log_file, 'a'),
|
|
140
123
|
Chook.config.logs_to_keep,
|
|
141
|
-
|
|
124
|
+
Chook.config.log_max_megs * 1024 * 1024
|
|
142
125
|
)
|
|
143
126
|
else
|
|
144
127
|
Logger.new(LogFileWithStream.new(Chook.config.log_file, 'a'))
|
|
@@ -164,6 +147,9 @@ module Chook
|
|
|
164
147
|
if level == Logger::DEBUG
|
|
165
148
|
@logger.debug 'Config: '
|
|
166
149
|
Chook::Configuration::CONF_KEYS.keys.each do |key|
|
|
150
|
+
# don't log :env, it might have sensitive data
|
|
151
|
+
next if key == :env
|
|
152
|
+
|
|
167
153
|
@logger.debug " Chook.config.#{key} = #{Chook.config.send key}"
|
|
168
154
|
end
|
|
169
155
|
end
|
|
@@ -6,6 +6,16 @@
|
|
|
6
6
|
font-family: "Lucida Console", Monaco, monospace;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
.label_cell {
|
|
10
|
+
text-align: right;
|
|
11
|
+
vertical-align: top;
|
|
12
|
+
padding-right: 5px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.value_cell {
|
|
16
|
+
text-align: left;
|
|
17
|
+
vertical-align: top;
|
|
18
|
+
}
|
|
9
19
|
|
|
10
20
|
/* ******* Title Header Area ******* */
|
|
11
21
|
|
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
### Section 6. Trademarks. is deleted and replaced with:
|
|
8
|
-
###
|
|
9
|
-
### 6. Trademarks. This License does not grant permission to use the trade
|
|
10
|
-
### names, trademarks, service marks, or product names of the Licensor
|
|
11
|
-
### and its affiliates, except as required to comply with Section 4(c) of
|
|
12
|
-
### the License and to reproduce the content of the NOTICE file.
|
|
13
|
-
###
|
|
14
|
-
### You may obtain a copy of the Apache License at
|
|
15
|
-
###
|
|
16
|
-
### http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
###
|
|
18
|
-
### Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
### distributed under the Apache License with the above modification is
|
|
20
|
-
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
|
-
### KIND, either express or implied. See the Apache License for the specific
|
|
22
|
-
### language governing permissions and limitations under the Apache License.
|
|
23
|
-
###
|
|
24
|
-
###
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
25
7
|
|
|
26
8
|
module Chook
|
|
27
9
|
|
|
@@ -33,7 +15,7 @@ module Chook
|
|
|
33
15
|
protect_via_basic_auth!
|
|
34
16
|
|
|
35
17
|
# rewind to ensure read-pointer is at the start
|
|
36
|
-
request.body.rewind
|
|
18
|
+
request.body.rewind
|
|
37
19
|
raw_json = request.body.read
|
|
38
20
|
|
|
39
21
|
event = Chook::HandledEvent.parse_event raw_json
|
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
### Section 6. Trademarks. is deleted and replaced with:
|
|
8
|
-
###
|
|
9
|
-
### 6. Trademarks. This License does not grant permission to use the trade
|
|
10
|
-
### names, trademarks, service marks, or product names of the Licensor
|
|
11
|
-
### and its affiliates, except as required to comply with Section 4(c) of
|
|
12
|
-
### the License and to reproduce the content of the NOTICE file.
|
|
13
|
-
###
|
|
14
|
-
### You may obtain a copy of the Apache License at
|
|
15
|
-
###
|
|
16
|
-
### http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
###
|
|
18
|
-
### Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
### distributed under the Apache License with the above modification is
|
|
20
|
-
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
|
-
### KIND, either express or implied. See the Apache License for the specific
|
|
22
|
-
### language governing permissions and limitations under the Apache License.
|
|
23
|
-
###
|
|
24
|
-
###
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
25
7
|
|
|
26
8
|
module Chook
|
|
27
9
|
|
|
@@ -33,7 +15,7 @@ module Chook
|
|
|
33
15
|
protect_via_basic_auth!
|
|
34
16
|
|
|
35
17
|
# rewind to ensure read-pointer is at the start
|
|
36
|
-
request.body.rewind
|
|
18
|
+
request.body.rewind
|
|
37
19
|
raw_json = request.body.read
|
|
38
20
|
|
|
39
21
|
event = Chook::HandledEvent.parse_event raw_json
|
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
### Section 6. Trademarks. is deleted and replaced with:
|
|
8
|
-
###
|
|
9
|
-
### 6. Trademarks. This License does not grant permission to use the trade
|
|
10
|
-
### names, trademarks, service marks, or product names of the Licensor
|
|
11
|
-
### and its affiliates, except as required to comply with Section 4(c) of
|
|
12
|
-
### the License and to reproduce the content of the NOTICE file.
|
|
13
|
-
###
|
|
14
|
-
### You may obtain a copy of the Apache License at
|
|
15
|
-
###
|
|
16
|
-
### http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
###
|
|
18
|
-
### Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
### distributed under the Apache License with the above modification is
|
|
20
|
-
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
|
-
### KIND, either express or implied. See the Apache License for the specific
|
|
22
|
-
### language governing permissions and limitations under the Apache License.
|
|
23
|
-
###
|
|
24
|
-
###
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
25
7
|
|
|
26
8
|
module Chook
|
|
27
9
|
|
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
### Section 6. Trademarks. is deleted and replaced with:
|
|
8
|
-
###
|
|
9
|
-
### 6. Trademarks. This License does not grant permission to use the trade
|
|
10
|
-
### names, trademarks, service marks, or product names of the Licensor
|
|
11
|
-
### and its affiliates, except as required to comply with Section 4(c) of
|
|
12
|
-
### the License and to reproduce the content of the NOTICE file.
|
|
13
|
-
###
|
|
14
|
-
### You may obtain a copy of the Apache License at
|
|
15
|
-
###
|
|
16
|
-
### http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
###
|
|
18
|
-
### Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
### distributed under the Apache License with the above modification is
|
|
20
|
-
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
|
-
### KIND, either express or implied. See the Apache License for the specific
|
|
22
|
-
### language governing permissions and limitations under the Apache License.
|
|
23
|
-
###
|
|
24
|
-
###
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
25
7
|
|
|
26
8
|
module Chook
|
|
27
9
|
|
|
@@ -29,7 +11,6 @@ module Chook
|
|
|
29
11
|
class Server < Sinatra::Base
|
|
30
12
|
|
|
31
13
|
get '/' do
|
|
32
|
-
|
|
33
14
|
# a list of current handlers for the admin page
|
|
34
15
|
@handlers_for_admin_page = []
|
|
35
16
|
|
|
@@ -49,7 +30,7 @@ module Chook
|
|
|
49
30
|
# a list of current named handlers for the admin page
|
|
50
31
|
@named_handlers_for_admin_page = []
|
|
51
32
|
|
|
52
|
-
Chook::HandledEvent::Handlers.named_handlers.each do |
|
|
33
|
+
Chook::HandledEvent::Handlers.named_handlers.each do |_name, handler|
|
|
53
34
|
if handler.is_a? Pathname
|
|
54
35
|
file = handler
|
|
55
36
|
type = :external
|
|
@@ -60,7 +41,6 @@ module Chook
|
|
|
60
41
|
@named_handlers_for_admin_page << { file: file, type: type }
|
|
61
42
|
end # handlers each
|
|
62
43
|
|
|
63
|
-
|
|
64
44
|
# the current config, for the admin page
|
|
65
45
|
@config_text =
|
|
66
46
|
if Chook::Configuration::DEFAULT_CONF_FILE.file?
|
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
### Section 6. Trademarks. is deleted and replaced with:
|
|
8
|
-
###
|
|
9
|
-
### 6. Trademarks. This License does not grant permission to use the trade
|
|
10
|
-
### names, trademarks, service marks, or product names of the Licensor
|
|
11
|
-
### and its affiliates, except as required to comply with Section 4(c) of
|
|
12
|
-
### the License and to reproduce the content of the NOTICE file.
|
|
13
|
-
###
|
|
14
|
-
### You may obtain a copy of the Apache License at
|
|
15
|
-
###
|
|
16
|
-
### http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
###
|
|
18
|
-
### Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
### distributed under the Apache License with the above modification is
|
|
20
|
-
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
|
-
### KIND, either express or implied. See the Apache License for the specific
|
|
22
|
-
### language governing permissions and limitations under the Apache License.
|
|
23
|
-
###
|
|
24
|
-
###
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
25
7
|
|
|
26
8
|
module Chook
|
|
27
9
|
|
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
### Section 6. Trademarks. is deleted and replaced with:
|
|
8
|
-
###
|
|
9
|
-
### 6. Trademarks. This License does not grant permission to use the trade
|
|
10
|
-
### names, trademarks, service marks, or product names of the Licensor
|
|
11
|
-
### and its affiliates, except as required to comply with Section 4(c) of
|
|
12
|
-
### the License and to reproduce the content of the NOTICE file.
|
|
13
|
-
###
|
|
14
|
-
### You may obtain a copy of the Apache License at
|
|
15
|
-
###
|
|
16
|
-
### http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
###
|
|
18
|
-
### Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
### distributed under the Apache License with the above modification is
|
|
20
|
-
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
|
-
### KIND, either express or implied. See the Apache License for the specific
|
|
22
|
-
### language governing permissions and limitations under the Apache License.
|
|
23
|
-
###
|
|
24
|
-
###
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
25
7
|
|
|
26
8
|
module Chook
|
|
27
9
|
|
|
@@ -42,7 +24,6 @@ module Chook
|
|
|
42
24
|
redirect '/'
|
|
43
25
|
end # get /
|
|
44
26
|
|
|
45
|
-
|
|
46
27
|
end # class
|
|
47
28
|
|
|
48
29
|
end # module
|