knjrbfw 0.0.115 → 0.0.116
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/lib/knj/erb/include.rb +46 -46
- data/lib/knj/eruby.rb +51 -51
- data/lib/knj/filesystem.rb +1 -1
- data/lib/knj/gettext_threadded.rb +19 -19
- data/lib/knj/includes/appserver_cli.rb +4 -4
- data/lib/knj/knj.rb +17 -17
- data/lib/knj/mount.rb +23 -23
- data/lib/knj/os.rb +52 -52
- data/lib/knj/power_manager.rb +8 -8
- data/lib/knj/scripts/svn_merge.rb +6 -6
- data/lib/knj/scripts/upgrade_knjrbfw_checker.rb +4 -4
- data/lib/knj/web.rb +1 -1
- data/lib/knj/webscripts/image.rhtml +40 -40
- data/lib/knj/webscripts/image_subproc.rhtml +2 -2
- data/lib/knj/win_tightvnc.rb +19 -19
- metadata +2 -2
@@ -5,17 +5,17 @@
|
|
5
5
|
rescue NameError
|
6
6
|
appsrv = _kas
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
#Support for the PHP-version... Comes handy when converting PHP to Ruby...
|
10
10
|
if !_get["path"]
|
11
11
|
trans = {
|
12
12
|
"picture" => "path"
|
13
13
|
}
|
14
|
-
|
14
|
+
|
15
15
|
if _get["edgesize"]
|
16
16
|
_get["rounded_corners"] = (_get["edgesize"].to_f / 3.0).to_i
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
if _get["edgeborder"]
|
20
20
|
if _get["edgeborder"].length == 6
|
21
21
|
_get["border_color"] = "##{_get["edgeborder"]}"
|
@@ -23,30 +23,30 @@
|
|
23
23
|
_get["border_color"] = _get["edbeborder"]
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
if _get["edgeborder"]
|
28
28
|
_get["border"] = 1
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
trans.each do |key, val|
|
32
32
|
_get[val] = _get[key] if _get[key]
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
#Base64-encoding of path.
|
37
37
|
if _get["path64"]
|
38
38
|
require "base64"
|
39
39
|
_get["path"] = Base64.decode64(_get["path64"])
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
require "digest/md5"
|
43
43
|
idstr = Digest::MD5.hexdigest("#{Process.euid}_#{_get["path"]}_#{_get["smartsize"].to_i}_#{_get["width"].to_i}_#{_get["height"].to_i}_#{_get["maxwidth"].to_i}_#{_get["maxheight"].to_i}_#{_get["rounded_corners"].to_i}_#{_get["border"].to_i}_#{_get["border_color"]}")
|
44
|
-
|
45
|
-
if !_get["path"] or !File.
|
44
|
+
|
45
|
+
if !_get["path"] or !File.exist?(_get["path"])
|
46
46
|
print "File does not exist: '#{_get["path"]}'.\n"
|
47
47
|
exit
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
time_orig = File.mtime(_get["path"])
|
51
51
|
tmp_write = false
|
52
52
|
if Knj::CONFIG["webscripts_image"]
|
@@ -54,65 +54,65 @@
|
|
54
54
|
else
|
55
55
|
tmp_path = "#{Knj::Os.tmpdir}/knjrbfw_image_#{idstr}"
|
56
56
|
end
|
57
|
-
|
58
|
-
tmp_exists = File.
|
57
|
+
|
58
|
+
tmp_exists = File.exist?(tmp_path)
|
59
59
|
tmp_write = true unless tmp_exists
|
60
|
-
|
60
|
+
|
61
61
|
if !tmp_write and tmp_exists
|
62
62
|
time_cache = File.mtime(tmp_path)
|
63
|
-
|
63
|
+
|
64
64
|
if time_orig > time_cache
|
65
65
|
tmp_write = true
|
66
66
|
end
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
if _get["force"] == "true" or _get["force"] == "1"
|
70
70
|
force = true
|
71
71
|
else
|
72
72
|
force = false
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
notchanged = false
|
76
|
-
|
76
|
+
|
77
77
|
if _httpsession.handler.modified_since and time_cache and _httpsession.handler.modified_since.utc.to_s == time_cache.utc.to_s
|
78
78
|
notchanged = true
|
79
79
|
elsif _httpsession.handler.modified_since and _httpsession.handler.modified_since.utc.to_s == time_orig.utc.to_s
|
80
80
|
notchanged = true
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
if notchanged and !force
|
84
84
|
_httpsession.resp.status = 304
|
85
85
|
exit
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
if tmp_write or force
|
89
89
|
blob_cont = nil
|
90
|
-
|
90
|
+
|
91
91
|
raise "RMagick has not been loaded. If loaded through here bugs will occur. Load in beginning of script." unless ::Kernel.const_defined?(:Magick)
|
92
92
|
pic = Magick::Image.read(_get["path"]).first
|
93
|
-
|
93
|
+
|
94
94
|
if !pic
|
95
95
|
print "Could not open image from '#{_get["path"]}'."
|
96
96
|
exit
|
97
97
|
end
|
98
|
-
|
98
|
+
|
99
99
|
pic.format = "png"
|
100
|
-
|
100
|
+
|
101
101
|
pic_columns = pic.columns
|
102
102
|
pic_rows = pic.rows
|
103
|
-
|
103
|
+
|
104
104
|
width = pic_columns
|
105
105
|
height = pic_rows
|
106
|
-
|
106
|
+
|
107
107
|
height = _get["height"].to_i if _get["height"]
|
108
108
|
width = _get["width"].to_i if _get["width"]
|
109
|
-
|
109
|
+
|
110
110
|
if _get["width"] && !_get["height"]
|
111
111
|
height = (pic_rows.to_f / (pic_columns.to_f / width.to_f)).to_i
|
112
112
|
elsif _get["height"] && !_get["width"]
|
113
113
|
width = (pic_columns.to_f / (pic_rows.to_f / height.to_f)).to_i
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
116
|
if _get["smartsize"]
|
117
117
|
if pic_columns > pic_rows
|
118
118
|
width = _get["smartsize"].to_i
|
@@ -122,51 +122,51 @@
|
|
122
122
|
width = (pic_columns.to_f / (pic_rows.to_f / height.to_f)).to_i
|
123
123
|
end
|
124
124
|
end
|
125
|
-
|
125
|
+
|
126
126
|
if _get["maxwidth"]
|
127
127
|
maxwidth = _get["maxwidth"].to_i
|
128
|
-
|
128
|
+
|
129
129
|
if width > maxwidth
|
130
130
|
height = (pic_rows.to_f / (pic_columns.to_f / maxwidth.to_f)).to_i
|
131
131
|
width = maxwidth
|
132
132
|
end
|
133
133
|
end
|
134
|
-
|
134
|
+
|
135
135
|
if _get["maxheight"]
|
136
136
|
maxheight = _get["maxheight"].to_i
|
137
|
-
|
137
|
+
|
138
138
|
if height > maxheight
|
139
139
|
width = (pic_columns.to_f / (pic_rows.to_f / maxheight.to_f)).to_i
|
140
140
|
height = maxheight
|
141
141
|
end
|
142
142
|
end
|
143
|
-
|
143
|
+
|
144
144
|
if _get["width"] and _get["height"]
|
145
145
|
width = _get["width"].to_i
|
146
146
|
height = _get["height"].to_i
|
147
147
|
end
|
148
|
-
|
148
|
+
|
149
149
|
if height != pic_rows or width != pic_columns
|
150
150
|
pic = pic.resize_to_fill(width.to_i, height.to_i)
|
151
151
|
end
|
152
|
-
|
152
|
+
|
153
153
|
if _get["rounded_corners"]
|
154
154
|
args = {:img => pic, :radius => _get["rounded_corners"].to_i}
|
155
|
-
|
155
|
+
|
156
156
|
if _get["border"] and _get["border_color"]
|
157
157
|
args[:border] = _get["border"].to_i
|
158
158
|
args[:border_color] = _get["border_color"]
|
159
159
|
end
|
160
|
-
|
160
|
+
|
161
161
|
#Call rounded_corners with the proxy-hash.
|
162
162
|
Knj::Image.rounded_corners(args)
|
163
163
|
end
|
164
|
-
|
164
|
+
|
165
165
|
pic.write(tmp_path) if tmp_write or force
|
166
166
|
end
|
167
|
-
|
168
|
-
raise "Picture was not written: '#{tmp_path}'." if !tmp_path || !File.
|
169
|
-
|
167
|
+
|
168
|
+
raise "Picture was not written: '#{tmp_path}'." if !tmp_path || !File.exist?(tmp_path)
|
169
|
+
|
170
170
|
appsrv.header("Last-Modified", "#{time_orig.httpdate} GMT") if time_orig
|
171
171
|
appsrv.header("Content-Type", "image/png")
|
172
172
|
_httpsession.force_fileread(tmp_path)
|
@@ -42,7 +42,7 @@
|
|
42
42
|
require "digest/md5"
|
43
43
|
idstr = Digest::MD5.hexdigest("#{_get["path"]}_#{_get["smartsize"].to_i}_#{_get["width"].to_i}_#{_get["height"].to_i}_#{_get["maxwidth"].to_i}_#{_get["maxheight"].to_i}_#{_get["rounded_corners"].to_i}_#{_get["border"].to_i}_#{_get["border_color"]}")
|
44
44
|
|
45
|
-
if !_get["path"] or !File.
|
45
|
+
if !_get["path"] or !File.exist?(_get["path"])
|
46
46
|
print "File does not exist: '#{_get["path"]}'.\n"
|
47
47
|
exit
|
48
48
|
end
|
@@ -56,7 +56,7 @@
|
|
56
56
|
tmp_path = "#{Knj::Os.tmpdir}/knjrbfw_image_#{idstr}"
|
57
57
|
end
|
58
58
|
|
59
|
-
tmp_exists = File.
|
59
|
+
tmp_exists = File.exist?(tmp_path)
|
60
60
|
tmp_write = true if !tmp_exists
|
61
61
|
|
62
62
|
if !tmp_write and tmp_exists
|
data/lib/knj/win_tightvnc.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
class Knj::Win::TightVNC
|
2
2
|
def initialize(args)
|
3
3
|
@args = ArrayExt.hash_sym(args)
|
4
|
-
|
4
|
+
|
5
5
|
@args[:port] = 5900 if !@args[:port]
|
6
6
|
@args[:port_http] = 5800 if !@args[:http_port]
|
7
|
-
|
7
|
+
|
8
8
|
raise "No path given." if !@args[:path]
|
9
|
-
|
9
|
+
|
10
10
|
exefile = @args[:path] + "/WinVNC.exe"
|
11
|
-
raise "#{exefile} was not found." if !File.
|
12
|
-
|
11
|
+
raise "#{exefile} was not found." if !File.exist?(exefile)
|
12
|
+
|
13
13
|
@wmi = WIN32OLE.connect("winmgmts://")
|
14
14
|
processes = @wmi.ExecQuery("SELECT * FROM win32_process")
|
15
15
|
ended = false
|
@@ -19,13 +19,13 @@ class Knj::Win::TightVNC
|
|
19
19
|
ended = true
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
sleep 1 if ended
|
24
|
-
|
24
|
+
|
25
25
|
#print Win::Registry.get(:cur_user, 'Software\ORL\WinVNC3', 'Password', :sz).unpack('H*')[0] + "\n"
|
26
26
|
#print ["160e9d46f26586ca"].pack('H*').unpack('H*')[0] + "\n"
|
27
27
|
#exit
|
28
|
-
|
28
|
+
|
29
29
|
Win::Registry.set(:cur_user, 'Software\ORL\WinVNC3', [
|
30
30
|
["AutoPortSelect", 1, :dword],
|
31
31
|
["BlankScreen", 0, :dword],
|
@@ -61,7 +61,7 @@ class Knj::Win::TightVNC
|
|
61
61
|
["LoopbackOnly", 0, :dword]
|
62
62
|
])
|
63
63
|
#password is of this moment only 'kaspernj'.
|
64
|
-
|
64
|
+
|
65
65
|
@wmi = WIN32OLE.connect("winmgmts://")
|
66
66
|
processes = @wmi.ExecQuery("SELECT * FROM win32_process")
|
67
67
|
ended = false
|
@@ -71,17 +71,17 @@ class Knj::Win::TightVNC
|
|
71
71
|
ended = true
|
72
72
|
end
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
sleep 1 if ended
|
76
|
-
|
76
|
+
|
77
77
|
Knj::Thread.new do
|
78
78
|
IO.popen(exefile) do |process|
|
79
79
|
#nothing
|
80
80
|
end
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
sleep 1
|
84
|
-
|
84
|
+
|
85
85
|
@processes = @wmi.ExecQuery("SELECT * FROM win32_process")
|
86
86
|
for process in @processes do
|
87
87
|
if process.Name == "WinVNC.exe"
|
@@ -89,14 +89,14 @@ class Knj::Win::TightVNC
|
|
89
89
|
break
|
90
90
|
end
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
raise "Could not start WinVNC.exe." if !@process
|
94
|
-
|
94
|
+
|
95
95
|
Kernel.at_exit do
|
96
96
|
self.close
|
97
97
|
end
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
def open?
|
101
101
|
begin
|
102
102
|
@process.GetOwner
|
@@ -105,10 +105,10 @@ class Knj::Win::TightVNC
|
|
105
105
|
return false
|
106
106
|
end
|
107
107
|
end
|
108
|
-
|
108
|
+
|
109
109
|
def close
|
110
110
|
return nil if !@process
|
111
|
-
|
111
|
+
|
112
112
|
begin
|
113
113
|
@process.Terminate
|
114
114
|
rescue => e
|
@@ -118,7 +118,7 @@ class Knj::Win::TightVNC
|
|
118
118
|
raise e
|
119
119
|
end
|
120
120
|
end
|
121
|
-
|
121
|
+
|
122
122
|
@process = nil
|
123
123
|
@args = nil
|
124
124
|
@wmi = nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knjrbfw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.116
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kasper Stöckel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: wref
|