no-style-please2-plugins 0.7.3 → 0.8.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab334d2c482d4209e3ba73781eacd5f3b0f5e1735500d879de12555f9e156df3
4
- data.tar.gz: 23eb54db2441640193bde976518f504630651305581d21d2e66eaa9008220e67
3
+ metadata.gz: eb824516aa69202aeb751b710764aea4f7c8e352bfcf94fe7ee426c66f354a45
4
+ data.tar.gz: dd951357fe4e823aa00456d13814ae8815fbf40026318b0e132554564a28dbfd
5
5
  SHA512:
6
- metadata.gz: d0fc8b380faf95c98d75ca79360e9a9ddd472900a30ff9eb8e92408ed33e89a51a56dbfd542daac121d326f97bc75c5f5f68f8f21e97ff1fa436f5e058998d3b
7
- data.tar.gz: ec8a98db075fb514a7a515e56c3c5f02193b49a9ebf8cad63af566d0e80ef604c98633aded8063bba993ffe23e3e1f448000df5f732ad8f749ea15618cf368a0
6
+ metadata.gz: d5ffba3bbbe75ba9dcfb62e15d01ce34ac76ec3d3dcdd554f4244dc93093575c4fbb93e3a67859b00e2ceee476baff27d911fefdf4aedff851d63042287cf3e2
7
+ data.tar.gz: 58266e9e6dfd9767022640fdc5bad66a5876537e4dcb49c744fff3a09180fba54b02d71a4807841d747f761b75166097da4b83437c19da9fb529592464ca22f3
data/Gemfile.lock CHANGED
@@ -1,87 +1,89 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- no-style-please2-plugins (0.4.0)
4
+ no-style-please2-plugins (0.7.4)
5
5
  digest
6
- jekyll (~> 4.2.0)
6
+ jekyll (~> 4.0)
7
7
  ltec (~> 0.1.2)
8
- salsa20 (~> 0.1.3)
9
8
 
10
9
  GEM
11
10
  remote: https://rubygems.org/
12
11
  specs:
13
- addressable (2.8.0)
14
- public_suffix (>= 2.0.2, < 5.0)
15
- base64 (0.1.1)
12
+ addressable (2.8.7)
13
+ public_suffix (>= 2.0.2, < 7.0)
14
+ base64 (0.1.2)
15
+ bigdecimal (3.1.8)
16
16
  colorator (1.1.0)
17
- concurrent-ruby (1.1.10)
18
- digest (3.1.0)
17
+ concurrent-ruby (1.3.4)
18
+ digest (3.1.1)
19
19
  em-websocket (0.5.3)
20
20
  eventmachine (>= 0.12.9)
21
21
  http_parser.rb (~> 0)
22
22
  eventmachine (1.2.7)
23
- ffi (1.15.5)
23
+ ffi (1.17.0-arm64-darwin)
24
24
  forwardable-extended (2.6.0)
25
+ google-protobuf (4.29.1-arm64-darwin)
26
+ bigdecimal
27
+ rake (>= 13)
25
28
  http_parser.rb (0.8.0)
26
- i18n (1.10.0)
29
+ i18n (1.14.6)
27
30
  concurrent-ruby (~> 1.0)
28
- ipaddr (1.2.4)
29
- jekyll (4.2.2)
31
+ jekyll (4.3.4)
30
32
  addressable (~> 2.4)
31
33
  colorator (~> 1.0)
32
34
  em-websocket (~> 0.5)
33
35
  i18n (~> 1.0)
34
- jekyll-sass-converter (~> 2.0)
36
+ jekyll-sass-converter (>= 2.0, < 4.0)
35
37
  jekyll-watch (~> 2.0)
36
- kramdown (~> 2.3)
38
+ kramdown (~> 2.3, >= 2.3.1)
37
39
  kramdown-parser-gfm (~> 1.0)
38
40
  liquid (~> 4.0)
39
- mercenary (~> 0.4.0)
41
+ mercenary (>= 0.3.6, < 0.5)
40
42
  pathutil (~> 0.9)
41
- rouge (~> 3.0)
43
+ rouge (>= 3.0, < 5.0)
42
44
  safe_yaml (~> 1.0)
43
- terminal-table (~> 2.0)
44
- jekyll-sass-converter (2.2.0)
45
- sassc (> 2.0.1, < 3.0)
45
+ terminal-table (>= 1.8, < 4.0)
46
+ webrick (~> 1.7)
47
+ jekyll-sass-converter (3.0.0)
48
+ sass-embedded (~> 1.54)
46
49
  jekyll-watch (2.2.1)
47
50
  listen (~> 3.0)
48
- kramdown (2.4.0)
49
- rexml
51
+ kramdown (2.5.1)
52
+ rexml (>= 3.3.9)
50
53
  kramdown-parser-gfm (1.1.0)
51
54
  kramdown (~> 2.0)
52
- liquid (4.0.3)
53
- listen (3.7.1)
55
+ liquid (4.0.4)
56
+ listen (3.9.0)
54
57
  rb-fsevent (~> 0.10, >= 0.10.3)
55
58
  rb-inotify (~> 0.9, >= 0.9.10)
56
- ltec (0.1.2.1)
59
+ ltec (0.1.3.1)
57
60
  base64 (~> 0.1.0)
58
- openssl (~> 2.2.0)
61
+ openssl
59
62
  mercenary (0.4.0)
60
- openssl (2.2.1)
61
- ipaddr
63
+ openssl (3.3.0)
62
64
  pathutil (0.16.2)
63
65
  forwardable-extended (~> 2.6)
64
- public_suffix (4.0.7)
65
- rake (13.0.6)
66
- rb-fsevent (0.11.1)
67
- rb-inotify (0.10.1)
66
+ public_suffix (6.0.1)
67
+ rake (13.2.1)
68
+ rb-fsevent (0.11.2)
69
+ rb-inotify (0.11.1)
68
70
  ffi (~> 1.0)
69
- rexml (3.2.5)
70
- rouge (3.28.0)
71
+ rexml (3.4.0)
72
+ rouge (4.5.1)
71
73
  safe_yaml (1.0.5)
72
- salsa20 (0.1.3)
73
- sassc (2.4.0)
74
- ffi (~> 1.9)
75
- terminal-table (2.0.0)
76
- unicode-display_width (~> 1.1, >= 1.1.1)
77
- unicode-display_width (1.8.0)
74
+ sass-embedded (1.82.0-arm64-darwin)
75
+ google-protobuf (~> 4.28)
76
+ terminal-table (3.0.2)
77
+ unicode-display_width (>= 1.1.1, < 3)
78
+ unicode-display_width (2.6.0)
79
+ webrick (1.9.1)
78
80
 
79
81
  PLATFORMS
80
- x86_64-darwin-20
82
+ arm64-darwin
81
83
 
82
84
  DEPENDENCIES
83
85
  no-style-please2-plugins!
84
86
  rake (~> 13.0)
85
87
 
86
88
  BUNDLED WITH
87
- 2.3.13
89
+ 2.5.23
data/README.md CHANGED
@@ -21,7 +21,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
21
21
 
22
22
  ## Usage
23
23
 
24
- see this [demo](https://vitock.ink/no-style-please-demo/)
24
+ see this [demo](https://vitock.github.io/no-style-please/)
25
25
 
26
26
  ## Development
27
27
 
data/lib/enc.rb CHANGED
@@ -5,9 +5,46 @@ require 'ltec'
5
5
  require "jekyll"
6
6
  require "fileutils"
7
7
  module Jekyll
8
- def test
9
- end
8
+
9
+
10
+
10
11
  class EncFilterTool
12
+ def EncFilterTool.getAllKey(page)
13
+ site = Jekyll::sites[0]
14
+ keys = []
15
+ key = "#{page['key']}"
16
+ if key != nil && key.length > 0
17
+ keys << key
18
+ end
19
+
20
+ posttags = page["tags"]
21
+ enctags = site.config['enc_tags']
22
+ if posttags && posttags.length > 0 && enctags
23
+
24
+ for tag in posttags
25
+ for enctag in enctags
26
+ if enctag['tag'] == tag
27
+ key = "#{enctag['password']}"
28
+ keys << key
29
+ end
30
+ end
31
+ end
32
+ end
33
+ keys.map do |key|
34
+ if key.length > 50
35
+ pubkey = ENV["JEKYLL_EC_PRIVATEKEY"]
36
+ if pubkey == nil
37
+ raise 'JEKYLL_EC_PRIVATEKEY not set on envionment'
38
+ end
39
+ key = Ltec::EC.decrypt(pubkey,key)
40
+
41
+ if key == nil || key.length == 0
42
+ raise "key decription fail"
43
+ end
44
+ end
45
+ key
46
+ end
47
+ end
11
48
  def EncFilterTool.getKey(content,page)
12
49
  site = Jekyll::sites[0]
13
50
  key = "#{page['key']}"
@@ -59,7 +96,15 @@ module Jekyll
59
96
  end
60
97
  module EncFilter
61
98
 
99
+
62
100
  $KeyMap = {}
101
+ def bin2hex(str)
102
+ str.unpack('C*').map{ |b| "%02x" % b }.join('')
103
+ end
104
+
105
+ def hex2bin(str)
106
+ [str].pack "H*"
107
+ end
63
108
  def genKey(password)
64
109
  cacheKey = $KeyMap[password]
65
110
  if cacheKey
@@ -80,7 +125,7 @@ module Jekyll
80
125
  cipher.iv = iv
81
126
  cipher.key = genKey password
82
127
  encrypted = cipher.update(msg) + cipher.final
83
- return 'E1.' + Base64.strict_encode64(iv + encrypted + cipher.auth_tag)
128
+ return 'E2.' + Base64.strict_encode64(iv + encrypted + cipher.auth_tag)
84
129
 
85
130
  end
86
131
  def get_encrypt_id(content,page)
@@ -92,7 +137,6 @@ module Jekyll
92
137
  return ""
93
138
  end
94
139
  end
95
-
96
140
  def encrypt_content(content,page,prefix)
97
141
  psw = EncFilterTool.getKey(content,page)
98
142
  psw = prefix + psw + prefix
@@ -123,6 +167,35 @@ module Jekyll
123
167
  return ''
124
168
  end
125
169
 
170
+ def rand_bytes(_,n2)
171
+ return bin2hex(OpenSSL::Random.random_bytes(n2))
172
+ end
173
+
174
+ def encrypt_content_v2(content,pswHex)
175
+ if !pswHex || pswHex.length != 64
176
+ raise "invalid Key:" + pswHex
177
+ end
178
+ cipher = OpenSSL::Cipher::AES.new(256, :CBC).encrypt
179
+ iv = cipher.random_iv
180
+ cipher.iv = iv
181
+ cipher.key = hex2bin(pswHex)
182
+ encrypted = cipher.update(content) + cipher.final
183
+ return 'E2.' + Base64.strict_encode64(iv + encrypted )
184
+ end
185
+
186
+
187
+ def encrypt_key(x,page,keyHex2Enc,encid)
188
+ arr = EncFilterTool.getAllKey(page)
189
+ newArr = arr.map do |k|
190
+ key = genKey encid + k + encid
191
+ hexKey = bin2hex key
192
+ encrypt_content_v2(hex2bin(keyHex2Enc),hexKey)
193
+ end
194
+
195
+ newArr.join('#')
196
+ end
197
+
198
+
126
199
 
127
200
  end
128
201
 
@@ -131,14 +204,6 @@ Liquid::Template.register_filter(Jekyll::EncFilter)
131
204
 
132
205
 
133
206
 
134
- def bin2hex(str)
135
- str.unpack('C*').map{ |b| "%02x" % b }.join('')
136
- end
137
-
138
- def hex2bin(str)
139
- [str].pack "H*"
140
- end
141
-
142
207
 
143
208
 
144
209
  end
data/lib/ext.rb CHANGED
@@ -123,6 +123,28 @@ module Jekyll
123
123
  end
124
124
  end
125
125
 
126
+ class IncludeFile < Liquid::Tag
127
+
128
+ def initialize(tag_name, text, tokens)
129
+ rootPath0 = $g_config['include_file_path'] || 'assets'
130
+ filePath0 = "#{rootPath0}/#{text}".strip!()
131
+ begin
132
+ file = File.open(filePath0)
133
+ @filecontent = file.read()
134
+ rescue => exception
135
+ puts exception
136
+ @filecontent = "load file:#{text} failed"
137
+
138
+ end
139
+
140
+ end
141
+
142
+ def render(context)
143
+ return @filecontent
144
+ end
145
+ end
146
+
147
+
126
148
 
127
149
  class IncludeCode < Liquid::Tag
128
150
  @filecontent = ""
@@ -161,6 +183,7 @@ EOF
161
183
  Liquid::Template.register_tag('include_code', Jekyll::IncludeCode)
162
184
  Liquid::Template.register_tag('post_link', Jekyll::PostLink)
163
185
  Liquid::Template.register_tag('img_link', Jekyll::ImgLink)
186
+ Liquid::Template.register_tag('include_file', Jekyll::IncludeFile)
164
187
 
165
188
 
166
189
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NoStylePlease2
4
- VERSION = "0.7.3"
4
+ VERSION = "0.8.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: no-style-please2-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vitock
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-23 00:00:00.000000000 Z
11
+ date: 2025-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll