cafe_basics 0.0.3 → 0.0.7

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cafe_basics.rb +532 -365
  3. metadata +2 -2
data/lib/cafe_basics.rb CHANGED
@@ -17,27 +17,29 @@ require 'cgi'
17
17
  require 'digest'
18
18
  require 'auto_click'
19
19
  require 'rainbow/refinement'
20
- require 'watir'
21
20
  include AutoClickMethods
22
21
  using Rainbow
23
-
22
+ include Glimmer
24
23
 
25
24
  class Chat
25
+
26
26
  def initialize(api_key)
27
27
  @api_key = api_key
28
28
  end
29
29
 
30
30
  def message2(keyword)
31
+ puts'[GPT] 키워드 기반 글을 생성 중입니다.......'.yellow
31
32
  url = 'https://api.openai.com/v1/chat/completions'
32
33
  h = {
33
34
  'Content-Type' => 'application/json',
34
35
  'Authorization' => 'Bearer ' + @api_key
35
36
  }
36
37
  d = {
37
- 'model' => 'gpt-3.5-turbo',
38
+ #'model' => 'gpt-3.5-turbo',
39
+ 'model' => 'gpt-4',
38
40
  'messages' => [{
39
41
  "role" => "assistant",
40
- "content" => keyword.to_s+" 소개하는 글만들어줘"
42
+ "content" => keyword.to_s+" 소개하는 글을 1500자에서 2500자 사이로 만들어줘"
41
43
  }]
42
44
  }
43
45
  answer = ''
@@ -68,10 +70,11 @@ class Chat
68
70
  'Authorization' => 'Bearer ' + @api_key
69
71
  }
70
72
  d = {
71
- 'model' => 'gpt-3.5-turbo',
73
+ #'model' => 'gpt-3.5-turbo',
74
+ 'model' => 'gpt-4',
72
75
  'messages' => [{
73
76
  "role" => "assistant",
74
- "content" => keyword.to_s+" 소개하는 글만들어줘"
77
+ "content" => keyword.to_s+" 관련된 글을 1500자에서 2500자 사이로 만들어줘"
75
78
  }]
76
79
  }
77
80
  answer = ''
@@ -102,23 +105,137 @@ class Chat
102
105
  end
103
106
  end
104
107
 
108
+ class Chat_title
109
+
110
+ def initialize(api_key)
111
+ @api_key = api_key
112
+ end
113
+
114
+ def message(title)
115
+ puts'[GPT] 유사 제목을 생성 중입니다.......'.yellow
116
+ url = 'https://api.openai.com/v1/chat/completions'
117
+ headers = {
118
+ 'Content-Type' => 'application/json',
119
+ 'Authorization' => 'Bearer ' + @api_key
120
+ }
121
+ data = {
122
+ 'model' => 'gpt-4',
123
+ 'messages' => [{
124
+ "role" => "system",
125
+ "content" => "너는 매우 친절하고 성의 있게 답변하는 AI 어시스턴트야."
126
+ },
127
+ {
128
+ "role" => "user",
129
+ "content" => "#{title}\n위 문장을 비슷한 길이로 ChatGPT의 멘트는 빼고 표현을 더 추가해서 하나만 만들어줘."
130
+ }]
131
+ }
132
+
133
+ begin
134
+ req = HTTP.headers(headers).post(url, json: data)
135
+ puts "HTTP Status: #{req.status}" # 상태 코드 확인
136
+ response = JSON.parse(req.body.to_s)
137
+ puts "API Response: #{response}" # 전체 응답 출력
138
+
139
+ if req.status == 429
140
+ return "API 요청 제한을 초과했습니다. 플랜 및 할당량을 확인하세요."
141
+ end
142
+
143
+ # 응답 데이터에서 안전하게 값 추출
144
+ answer = response.dig('choices', 0, 'message', 'content')
145
+ answer ||= (title) # 응답이 없을 경우 기본 메시지 설정
146
+ rescue => e
147
+ puts "Error: #{e.message}"
148
+ answer = "오류가 발생했습니다."
149
+ end
150
+
151
+ puts 'API return ==> '
152
+ puts answer
153
+ answer
154
+ end
155
+ end
156
+
157
+ class Chat_content
158
+
159
+ def initialize(api_key)
160
+ @api_key = api_key
161
+ end
162
+
163
+ def message(content)
164
+ puts'[GPT] 유사 내용을 생성 중입니다! 조금만 기다려주세요.......'.yellow
165
+ url = 'https://api.openai.com/v1/chat/completions'
166
+ headers = {
167
+ 'Content-Type' => 'application/json',
168
+ 'Authorization' => 'Bearer ' + @api_key
169
+ }
170
+ data = {
171
+ 'model' => 'gpt-4',
172
+ 'messages' => [{
173
+ "role" => "system",
174
+ "content" => "너는 매우 친절하고 성의 있게 답변하는 AI 어시스턴트야."
175
+ },
176
+ {
177
+ "role" => "user",
178
+ "content" => "#{content}\nChatGPT의 멘트는 빼고 위 전체적인 내용의 형식을 똑같이 표현을 더 추가하고 유사어로 변경하여 하나 만들어줘! 전화번호,연락처,가격,홈페이지안내 ,상담안내 관련 문구는 유지해야해"
179
+ }]
180
+ }
181
+
182
+ begin
183
+ req = HTTP.headers(headers).post(url, json: data)
184
+ puts "HTTP Status: #{req.status}" # 상태 코드 확인
185
+ response = JSON.parse(req.body.to_s)
186
+ puts "API Response: #{response}" # 전체 응답 출력
187
+
188
+ if req.status == 429
189
+ return "API 요청 제한을 초과했습니다. 플랜 및 할당량을 확인하세요."
190
+ end
191
+
192
+ # 응답 데이터에서 안전하게 값 추출
193
+ answer = response.dig('choices', 0, 'message', 'content')
194
+ answer ||= (content) # 응답이 없을 경우 기본 메시지 설정
195
+ rescue => e
196
+ puts "Error: #{e.message}"
197
+ answer = "오류가 발생했습니다."
198
+ end
199
+
200
+ puts 'API return ==> '
201
+ puts answer
202
+ answer
203
+ end
204
+ end
205
+
206
+
207
+ #############################################gpt############################################
208
+
105
209
  class Naver
106
210
  def initialize
107
211
  @seed = 1
108
- @cookie = ''
109
212
  end
213
+ def chrome_setup(user_id)
214
+ naver_cookie_dir = "C:/naver_cookie"
215
+ FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
216
+ system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id}})
110
217
 
111
- def chrome_start(proxy)
218
+ end
219
+ def chrome_start(proxy, user_id)
220
+ naver_cookie_dir = "C:/naver_cookie"
221
+ FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
112
222
  if proxy == ''
113
223
  begin
114
224
  Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
115
- @driver = Selenium::WebDriver.for :chrome
225
+ options = Selenium::WebDriver::Chrome::Options.new
226
+ options.page_load_strategy = :normal
227
+ options.timeouts = {page_load: 20_000}
228
+ options.page_load_strategy = 'none'
229
+ options.add_argument('--remote-debugging-port=9222')
230
+ options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
231
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
116
232
  rescue
117
- @driver = Selenium::WebDriver.for :chrome
233
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
118
234
  end
119
235
  else
120
236
  begin
121
237
  Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
238
+ options = Selenium::WebDriver::Chrome::Options.new
122
239
  # profile = Selenium::WebDriver::Chrome::Profile.new
123
240
  # profile['network.proxy.type'] = 1
124
241
  # profile['network.proxy.http'] = proxy.split(':')[0]
@@ -127,177 +244,114 @@ class Naver
127
244
  # options.profile = profile
128
245
  options = Selenium::WebDriver::Chrome::Options.new
129
246
  options.add_argument '--proxy-server='+proxy.to_s.force_encoding('utf-8').to_s
130
- @driver = Selenium::WebDriver.for(:chrome, options: options)
247
+ options.page_load_strategy = :normal
248
+ options.timeouts = {page_load: 20_000}
249
+ options.page_load_strategy = 'none'
250
+ options.add_argument('--remote-debugging-port=9222')
251
+ options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
252
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
131
253
  rescue => e
132
254
  puts e
133
255
  puts 'proxy error...'
134
256
  begin
135
257
  Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
136
- @driver = Selenium::WebDriver.for :chrome
258
+ options = Selenium::WebDriver::Chrome::Options.new
259
+ options.page_load_strategy = :normal
260
+ options.timeouts = {page_load: 20_000}
261
+ options.page_load_strategy = 'none'
262
+ options.add_argument('--remote-debugging-port=9222')
263
+ options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
264
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
137
265
  rescue
138
- @driver = Selenium::WebDriver.for :chrome
266
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
139
267
  end
140
268
  end
141
269
  end
142
270
  end
143
271
 
272
+
273
+
144
274
  def login(user_id, user_pw, proxy)
145
275
  @user_id = user_id
146
276
  @user_id11 = user_id
147
- chrome_start(proxy)
148
- @driver.get('https://www.naver.com')
149
- sleep(1)
150
- user_cookie_file = Array.new
151
- begin
152
- Dir.entries('./cookie').each do |i|
153
- if i == '.' or i == '..'
277
+ current_dir = File.dirname(__FILE__)
278
+ naver_cookie_dir = "C:/naver_cookie"
279
+ FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
154
280
 
155
- else
156
- user_cookie_file << i
157
- end
281
+
282
+
283
+ unless File.exist?("C:/naver_cookie/" + user_id)
284
+ driverfile_src = File.join(current_dir, 'driverfile')
285
+ if Dir.exist?(driverfile_src)
286
+ FileUtils.cp_r(driverfile_src, "C:/naver_cookie/" + user_id)
287
+
158
288
  end
159
- rescue
289
+ end
160
290
 
161
- end
291
+ # 새로운 스레드 생성 및 실행
292
+ Thread.new { chrome_setup(user_id) }
293
+ sleep(3)
162
294
 
163
- @cookie4 = Hash.new
164
- if user_cookie_file.include?(user_id+'.txt')
165
- f = File.open('./cookie/'+user_id+'.txt', 'r')
166
- @cookie4 = JSON.parse(f.read())
167
- f.close
168
- end
169
295
 
170
- begin
171
- @cookie4.each do |i|
172
- p i
173
- @driver.manage.add_cookie(name: i['name'], value: i['value'], same_site: i['same_site'], domain: i['domain'], path: i['path'])
174
- end
175
- rescue
296
+ chrome_start(proxy, user_id)
297
+ @driver.get('https://www.naver.com')
298
+ puts'[Step.01] 계정 로그인 및 세션 확인.......'.yellow
299
+
176
300
 
177
- end
178
301
  sleep(1)
179
- @driver.get('https://www.naver.com')
302
+
180
303
  begin
181
- # begin
182
- # @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="minime"]'))
183
- # rescue
184
-
185
- # end
186
- @driver.find_element(:xpath, '//*[@id="account"]/div/a').click
304
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
305
+ #요소가 나타날 때까지 3초 동안 기다립니다.
306
+ wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]') }
307
+ sleep(1.5)
308
+ @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]').click
187
309
  check_cookie_login = 0
310
+ sleep(1)
188
311
  rescue
189
312
  check_cookie_login = 1
313
+ puts'[Step.02] 계정 세션 확인!! 로그인 skip.......'.yellow
314
+ sleep(2.5)
190
315
  end
191
316
 
192
317
  if check_cookie_login == 0
318
+ puts'[Step.02] 계정 세션이 없거나 기간 만료로 인해 로그인 시도.......'.yellow
193
319
  # @driver.find_element(:xpath, '//*[@id="right-content-area"]/div[1]/div[1]/div/a').click
194
320
  sleep(3)
195
- @driver.find_element(:xpath, '//*[@id="login_keep_wrap"]/div[2]/span/label').click
196
- sleep(2)
321
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
322
+ #요소가 나타날 때까지 3초 동안 기다립니다.
323
+ wait.until { @driver.find_element(:xpath, '//*[@for="switch"]') }
324
+ sleep(1.5)
325
+ @driver.find_element(:xpath, '//*[@id="login_keep_wrap"]/div[1]/label').click
326
+ sleep(1.5)
197
327
  @driver.find_element(:xpath, '//*[@id="id"]').click
198
328
  Clipboard.copy(user_id)
199
329
  @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
200
- sleep(3)
330
+ sleep(1.5)
201
331
  @driver.find_element(:xpath, '//*[@id="pw"]').click
202
332
  Clipboard.copy(user_pw)
203
333
  @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
204
- sleep(3)
334
+ sleep(1.5)
205
335
  @driver.find_element(:xpath, '//*[@id="log.login"]').click
206
- sleep(3)
336
+ sleep(2.5)
337
+
207
338
  else
208
339
  # @driver.switch_to.default_content
209
340
  end
210
341
 
211
- @cookie = ''
212
- cookie2 = Array.new
213
- @driver.manage.all_cookies.each do |i|
214
- puts i
215
- @cookie += i[:name]+'='+i[:value]+'; '
216
- cookie2 << i
217
- end
218
-
219
- File.open('./cookie/'+user_id+'.txt', 'w') do |ff|
220
- ff.write(cookie2.to_json)
221
- end
222
-
223
-
224
-
225
- sleep(2)
226
342
  begin
227
- @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="my-iframe"]'))
228
- puts @driver.find_element(:xpath, '/html/body/div/div/div[1]/div[1]/a[1]').text
229
- @driver.find_element(:xpath, '//*[@id="account"]/div[2]/div/div/ul/li[3]/a/span').click
230
- return 1
343
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
344
+ #요소가 나타날 때까지 3초 동안 기다립니다.
345
+ wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__btn_logout___bsTOJ"]') }
346
+
231
347
  rescue => e
348
+ puts '-[√] 로그인 실패!!.......'.red
232
349
  puts e
233
- return 1
234
- end
235
- # if @driver.current_url.include?('viewPhoneInfo')
236
- # #@driver.get('https://blog.naver.com/'+user_id)
237
- # #@driver.get('https://blog.naver.com/MyBlog.naver')
238
- # sleep(1)
239
- # @driver.find_element(:xpath, '//*[@id="account"]/div[2]/div/div/ul/li[3]/a').click
240
- # sleep(1)
241
- # @driver.find_element(:xpath, '//*[@id="account"]/div[3]/div[2]/div[1]/a[2]').click
242
- # sleep(1)
243
- # @driver.switch_to.window(@driver.window_handles[1])
244
- # @user_id = @driver.current_url.split('/')[-1]
245
- # @url = 'https://blog.naver.com/'+@user_id
246
- # @driver.close
247
- # @driver.switch_to.window(@driver.window_handles[0])
248
- # return 1
249
- # else
250
- # begin
251
- # sleep(2)
252
- # # @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="my-iframe"]'))
253
- # # puts @driver.find_element(:xpath, '/html/body/div/div/div[1]/div[1]/a[1]').text
254
- # # @driver.find_element(:xpath, '//*[@id="account"]/div[2]/div/div/ul/li[3]/a/span').click
255
- # # sleep(1)
256
- # # @driver.find_element(:xpath, '//*[@id="account"]/div[2]/div/div/ul/li[3]/a/span')
257
- # #@driver.get('https://blog.naver.com/'+user_id)
258
- # # @driver.get('https://blog.naver.com/MyBlog.naver')
259
- # @driver.find_element(:xpath, '//*[@id="account"]/div[2]/div/div/ul/li[3]/a').click
260
- # sleep(1)
261
- # @driver.find_element(:xpath, '//*[@id="account"]/div[3]/div[2]/div[1]/a[2]').click
262
- # sleep(1)
263
- # sleep(1)
264
- # @driver.switch_to.window(@driver.window_handles[1])
265
- # @user_id = @driver.current_url.split('/')[-1]
266
- # @url = 'https://blog.naver.com/'+@user_id
267
- # @driver.close
268
- # @driver.switch_to.window(@driver.window_handles[0])
269
- # return 1
270
- # rescue => e
271
- # puts e
272
- # @driver.close
273
- # return 0
274
- # end
275
- # end
276
- end
277
-
278
- def driver_close
279
- begin
280
350
  @driver.close
281
- rescue
282
-
351
+ return 0
283
352
  end
284
353
  end
285
354
 
286
- def title_action(text)
287
- @driver.find_element(:xpath, '/html/body/div[1]/div/div[3]/div/div/div[1]/div/div[1]/div[2]/section/article/div[1]/div[1]/div').click
288
- Clipboard.copy(text)
289
- @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
290
- end
291
-
292
- def update_test
293
- @driver.get('https://blog.naver.com/'+@user_id+'?Redirect=Write')
294
- sleep(1)
295
- @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="mainFrame"]'))
296
-
297
- title_action('제목 test')
298
-
299
- end
300
-
301
355
  def create_id
302
356
  @seed += 1
303
357
  hash = Digest::SHA256.hexdigest((Time.now.to_i+@seed).to_s).to_s
@@ -623,52 +677,10 @@ class Naver
623
677
  noko = Nokogiri::HTML(content, nil, Encoding::UTF_8.to_s)
624
678
  toomung = 0
625
679
  h = Hash.new
626
- # h[:authority] = 'blog.naver.com'
627
- # h[:method] = 'POST'
628
- # h[:path] = '/RabbitWrite.naver'
629
- # h[:scheme] = 'https'
630
- # h['accept'] = 'application/json, text/plain, */*'
631
- # h['accept-encoding'] = 'gzip, deflate, br'
632
- # h['accept-language'] = 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7'
633
- # h['content-type'] = 'application/x-www-form-urlencoded'
634
- # h['cookie'] = @cookie
635
- # h['origin'] = 'https://blog.naver.com'
636
- # h['referer'] = 'https://blog.naver.com/'+@user_id+'/postwrite?categoryNo=1'
637
- # h['sec-ch-ua'] = '"Chromium";v="106", "Google Chrome";v="106", "Not;A=Brand";v="99"'
638
- # h['sec-ch-ua-mobile'] = '?0'
639
- # h['sec-ch-ua-platform'] = '"Windows"'
640
- # h['sec-fetch-dest'] = 'empty'
641
- # h['sec-fetch-mode'] = 'cors'
642
- # h['sec-fetch-site'] = 'same-origin'
643
- # h['user-agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36'
680
+
644
681
 
645
682
  data = Hash.new
646
- # data['blogId'] = @user_id
647
- # data['documentModel'] = Hash.new
648
- # data['documentModel']['documentId'] = ''
649
- # data['documentModel']['document'] = Hash.new
650
- # data['documentModel']['document']['version'] = '2.6.0'
651
- # data['documentModel']['document']['theme'] = 'default'
652
- # data['documentModel']['document']['language'] = 'ko-KR'
653
- # data['documentModel']['document']['components'] = Array.new
654
- # data['documentModel']['document']['components'][0] = {
655
- # 'id' => create_id(),
656
- # 'layout' => 'default',
657
- # 'title' => [
658
- # {
659
- # 'id' => create_id(),
660
- # 'nodes' => [{
661
- # 'id' => create_id(),
662
- # 'value' => title,
663
- # '@ctype' => 'textNode'
664
- # }],
665
- # '@ctype' => 'paragraph'
666
- # }
667
- # ],
668
- # 'subTitle' => nil,
669
- # 'align' => 'left',
670
- # '@ctype' => 'documentTitle'
671
- # }
683
+
672
684
 
673
685
  check_position = 1
674
686
  noko.css('p').each do |i|
@@ -718,21 +730,7 @@ class Naver
718
730
  sleep(3)
719
731
  key_stroke('enter')
720
732
  sleep(3)
721
- # @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
722
- # puts path = CGI.unescape(path)
723
- # image_data = image_update(path)
724
- # components_value = Hash.new
725
- # components_value['id'] = create_id()
726
- # components_value['layout'] = 'default'
727
- # begin
728
- # if i.to_s.split('text-align: ')[1].split(';')[0] == 'center'
729
- # components_value['align'] = 'center'
730
- # elsif i.to_s.split('text-align: ')[1].split(';')[0] == 'right'
731
- # components_value['align'] = 'right'
732
- # else
733
-
734
- # end
735
- # rescue
733
+
736
734
 
737
735
  if i2.to_s.split('href="')[1] != nil
738
736
  href2 = i2.to_s.split('href="')[1].split('"')[0]
@@ -748,30 +746,7 @@ class Naver
748
746
  #key_stroke('enter')
749
747
  sleep(1)
750
748
  end
751
- # end
752
- # components_value['src'] = 'https://blogfiles.pstatic.net'+image_data['item']['url']+'?type=w1'
753
- # components_value['internalResource'] = true
754
- # components_value['represent'] = true
755
- # components_value['path'] = image_data['item']['url']
756
- # components_value['domain'] = "https://blogfiles.pstatic.net"
757
- # components_value['fileSize'] = image_data['item']['fileSize'].to_i
758
- # components_value['width'] = image_data['item']['width'].to_i
759
- # components_value['widthPercentage'] = 0
760
- # components_value['height'] = image_data['item']['height'].to_i
761
- # components_value['fileName'] = image_data['item']['fileName'].to_i
762
- # components_value['caption'] = nil
763
- # if i2.to_s.split('href="')[1] != nil
764
- # components_value['link'] = CGI.unescape(i2.to_s.split('href="')[1].split('"')[0])
765
- # end
766
- # components_value['format'] = 'normal'
767
- # components_value['displayFormat'] = 'normal'
768
- # components_value['imageLoaded'] = true
769
- # components_value['contentMode'] = 'fit'
770
- # components_value['origin'] = {
771
- # 'srcFrom' => 'local',
772
- # '@ctype' => 'imageOrigin'
773
- # }
774
- # components_value['@ctype'] = 'image'
749
+
775
750
  elsif i2.to_s.include?('<video')
776
751
  path = i2.to_s.split('src="')[1].split('"')[0]
777
752
  path = URI.decode_www_form(path)[0][0]
@@ -810,8 +785,8 @@ class Naver
810
785
  @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]').click
811
786
  @driver.action.send_keys(title).perform
812
787
  sleep(1)
813
-
814
788
  @driver.action.key_down(:enter).key_up(:enter).perform #엔터
789
+ sleep(1)
815
790
 
816
791
  elsif i2.to_s.include?('<inyonggoo')
817
792
  if i2.text == ''
@@ -1649,95 +1624,21 @@ class Wordpress
1649
1624
  end
1650
1625
  end
1651
1626
 
1652
- def login
1653
- @driver.get(@url+'/wp-admin')
1654
- @driver.find_element(:xpath , '//*[@id="user_login"]').send_keys(@user_id)
1655
- @driver.find_element(:xpath , '//*[@id="user_pass"]').send_keys(@user_pw)
1656
- @driver.find_element(:xpath , '//*[@id="wp-submit"]').click
1657
- @cookie = Hash.new
1658
- @driver.manage.all_cookies.each do |i|
1659
- @cookie[i[:name]] = i[:value]
1660
- end
1661
- sleep(2)
1662
- begin
1663
- puts @driver.find_element(:xpath , '/html/body/div/div/div[1]/div[1]/div/div[1]/a[1]/span').text
1664
- @driver.close
1665
- return 1
1666
- rescue => e
1667
- puts e
1668
- @driver.close
1669
- return 0
1670
- end
1671
- end
1672
1627
 
1673
- def update
1674
- http = HTTP.cookies(@cookie).get(@url+'/wp-admin/post-new.php')
1675
- noko = Nokogiri::HTML(http.to_s)
1676
- @wpnonce = http.to_s.split('_wpnonce":"')[1].split('"')[0]
1677
- @data2 = Hash.new
1678
- @data2['_wpnonce'] = noko.xpath('//*[@id="_wpnonce"]')[0]['value']
1679
- @data2['_wp_http_referer'] = '/wp-admin/post-new.php'
1680
- @data2['user_ID'] = '1'
1681
- @data2['action'] = 'editpost'
1682
- @data2['originalaction'] = 'editpost'
1683
- @data2['post_author'] = '1'
1684
- @data2['post_type'] = 'post'
1685
- @data2['original_post_status'] = 'auto-draft'
1686
- @data2['referredby'] = @url+'/wp-admin/update-core.php'
1687
- @data2['_wp_original_http_referer'] = @url+'/wp-admin/update-core.php'
1688
- @data2['auto_draft'] = nil
1689
- @data2['post_ID'] = noko.xpath('//*[@id="post_ID"]')[0]['value']
1690
- @data2['meta-box-order-nonce'] = noko.xpath('//*[@id="meta-box-order-nonce"]')[0]['value']
1691
- @data2['closedpostboxesnonce'] = noko.xpath('//*[@id="closedpostboxesnonce"]')[0]['value']
1692
- @data2['post_title'] = 'title3'
1693
- @data2['samplepermalinknonce'] = noko.xpath('//*[@id="samplepermalinknonce"]')[0]['value']
1694
- @data2['content'] = 'content3'
1695
- @data2['wp-preview'] = nil
1696
- @data2['hidden_post_status'] = 'draft'
1697
- @data2['post_status'] = 'draft'
1698
- @data2['hidden_post_password'] = nil
1699
- @data2['hidden_post_visibility'] = 'public'
1700
- @data2['visibility'] = 'post'
1701
- @data2['post_password'] = nil
1702
- @data2['mm'] = '10'
1703
- @data2['jj'] = '24'
1704
- @data2['aa'] = '2022'
1705
- @data2['hh'] = '02'
1706
- @data2['mn'] = '41'
1707
- @data2['ss'] = '32'
1708
- @data2['hidden_mm'] = '10'
1709
- @data2['cur_mm'] = '10'
1710
- @data2['hidden_jj'] = '24'
1711
- @data2['cur_jj'] = '24'
1712
- @data2['hidden_aa'] = '2022'
1713
- @data2['cur_aa'] = '2022'
1714
- @data2['hidden_hh'] = '02'
1715
- @data2['cur_hh'] = '02'
1716
- @data2['hidden_mn'] = '41'
1717
- @data2['cur_mn'] = '41'
1718
- @data2['original_publish'] = '공개'
1719
- @data2['publish'] = '공개'
1720
- @data2['post_format'] = '0'
1721
- @data2['post_category[]'] = '0'
1722
- @data2['newcategory'] = '새 카테고리 이름'
1723
- @data2['newcategory_parent'] = -1
1724
- @data2['_ajax_nonce-add-category'] = noko.xpath('//*[@id="_ajax_nonce-add-category"]')[0]['value']
1725
- @data2['tax_input[post_tag]'] = nil
1726
- @data2['newtag[post_tag]'] = nil
1727
- @data2['_thumbnail_id'] = -1
1728
- @data2['excerpt'] = nil
1729
- @data2['trackback_url'] = nil
1730
- @data2['metakeyinput'] = nil
1731
- @data2['metavalue'] = nil
1732
- @data2['_ajax_nonce-add-meta'] = noko.xpath('//*[@id="_ajax_nonce-add-meta"]')[0]['value']
1733
- @data2['advanced_view'] = '1'
1734
- @data2['comment_status'] = 'open'
1735
- @data2['ping_status'] = 'open'
1736
- @data2['post_name'] = nil
1737
- @data2['post_author_override'] = '1'
1738
- #result_http = HTTP.cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data)
1739
- return @data2
1740
- end
1628
+
1629
+ #def chrome_start(url, user_id, user_pw)
1630
+ # @url = url
1631
+ # @user_id = user_id
1632
+ # @user_pw = user_pw
1633
+ # begin
1634
+ # Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
1635
+ # @driver = Selenium::WebDriver.for :chrome
1636
+ # rescue
1637
+ # @driver = Selenium::WebDriver.for :chrome
1638
+ # end
1639
+ #end
1640
+
1641
+
1741
1642
 
1742
1643
  def auto_image
1743
1644
  begin
@@ -1966,8 +1867,7 @@ class Wordpress
1966
1867
  @inumber2 = 0
1967
1868
  @video = Array.new
1968
1869
 
1969
- price_hash = Hash.new
1970
-
1870
+
1971
1871
  while true
1972
1872
  for n in 0..@data['table'].length-1
1973
1873
  @data['table'][n][10] = 0
@@ -2060,6 +1960,13 @@ class Wordpress
2060
1960
  end
2061
1961
  end
2062
1962
  end
1963
+
1964
+ if @data['포스트설정']['gpt제목'].checked?
1965
+ chat = Chat_title.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'))
1966
+ gpt_text1 = chat.message(title)
1967
+ title = gpt_text1.to_s
1968
+ end
1969
+
2063
1970
  @data['table'][index][-1] = 5
2064
1971
  @data['table'] << []
2065
1972
  @data['table'].pop
@@ -2097,6 +2004,25 @@ class Wordpress
2097
2004
  end
2098
2005
  end
2099
2006
  end
2007
+
2008
+
2009
+ if @data['포스트설정']['gpt내용'].checked?
2010
+ api_key = @data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8')
2011
+ #key_change = @data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8')
2012
+ #imotcon_change = @data['포스트설정']['스티커로변경단어'].text.to_s.force_encoding('utf-8')
2013
+ #template_change = @data['포스트설정']['내템플릿변경단어'].text.to_s.force_encoding('utf-8')
2014
+ #ttdanar_change = @data['포스트설정']['단어링크적용단어'].text.to_s.force_encoding('utf-8')
2015
+ #sajine_change = @data['포스트설정']['단어사진으로변경단어'].text.to_s.force_encoding('utf-8')
2016
+ #mov_change = @data['포스트설정']['영상으로변경단어'].text.to_s.force_encoding('utf-8')
2017
+ #map_change = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8')
2018
+ #inyong9_change = @data['포스트설정']['인용구변경단어'].text.to_s.force_encoding('utf-8')
2019
+
2020
+
2021
+ chat = Chat_content.new(api_key)
2022
+ gpt_text3 = chat.message(content)
2023
+ content = gpt_text3.to_s
2024
+ end
2025
+
2100
2026
  content_tag = content.split('@##@')[1]
2101
2027
  content = content.split('@##@')[0]
2102
2028
  @data['table'][index][-1] = 15
@@ -2295,7 +2221,7 @@ class Wordpress
2295
2221
  @data['table'][index][-1] = 50
2296
2222
  @data['table'] << []
2297
2223
  @data['table'].pop
2298
- if @data['포스트설정']['gpt'].checked?
2224
+ if @data['포스트설정']['gpt키워드'].checked?
2299
2225
  chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'))
2300
2226
  gpt_text = chat.message(keyword)
2301
2227
  content = content + "\n(자동생성글)\n" + gpt_text
@@ -2316,7 +2242,7 @@ class Wordpress
2316
2242
  joongbok_check = 0
2317
2243
  counter10 = 0
2318
2244
  while joongbok_check == 0
2319
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2245
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2320
2246
  content22 = content.split("(자동생성글)")[1].split("\n")
2321
2247
  else
2322
2248
  content22 = content.split("\n")
@@ -2340,12 +2266,12 @@ class Wordpress
2340
2266
  content2 = content.split("\n")
2341
2267
  end
2342
2268
 
2343
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2269
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2344
2270
  content2 = content.split("(자동생성글)")[1].split("\n")
2345
2271
  position.pop
2346
2272
  end
2347
2273
 
2348
- if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt'].checked? == false
2274
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt키워드'].checked? == false
2349
2275
  content2 = content.split("\n")
2350
2276
  end
2351
2277
 
@@ -2391,7 +2317,7 @@ class Wordpress
2391
2317
  content = content3.join("\n")
2392
2318
  end
2393
2319
 
2394
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2320
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2395
2321
  content2.each_with_index do |con, index|
2396
2322
  if position.include?(index)
2397
2323
  insert_keyword_text = keyword.to_s
@@ -2421,7 +2347,7 @@ class Wordpress
2421
2347
  end
2422
2348
  end
2423
2349
 
2424
- if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt'].checked? == false
2350
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt키워드'].checked? == false
2425
2351
  begin
2426
2352
  content2.each_with_index do |con, index|
2427
2353
  if position.include?(index)
@@ -2516,7 +2442,7 @@ class Wordpress
2516
2442
  end
2517
2443
  end
2518
2444
 
2519
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2445
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2520
2446
  if @data['포스트설정']['자동글 수식에 입력'].checked?
2521
2447
  content5 = content.split("(자동생성글)")[0].to_s.split("\n")
2522
2448
  content55 = content.split("(자동생성글)")[1].to_s
@@ -2546,9 +2472,9 @@ class Wordpress
2546
2472
  end
2547
2473
  end
2548
2474
 
2549
- position = position.sort
2475
+ position = position.sort
2550
2476
  ##여기서부터 이미지 순서대로 안되서 변경####-------------------------------------------------------------------------------
2551
- # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2477
+ # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2552
2478
  # image_url22 = get_image_file().force_encoding('utf-8')
2553
2479
  # end
2554
2480
 
@@ -2566,7 +2492,7 @@ class Wordpress
2566
2492
  # end
2567
2493
  # end
2568
2494
 
2569
- # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2495
+ # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2570
2496
  # content = content5.join("\n")+'(자동생성글)'+content55
2571
2497
  # iconv = Iconv.new('UTF-8', 'ASCII-8BIT')
2572
2498
  # content = iconv.iconv(content)
@@ -2586,7 +2512,7 @@ class Wordpress
2586
2512
  ###여기까지 이미지 순서대로 안되서 변경##-------------------------------------------------------------------------------
2587
2513
 
2588
2514
  ##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
2589
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2515
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2590
2516
  sleep(2)
2591
2517
  puts '이미지 자동 세탁 중 · · · '
2592
2518
  end
@@ -2605,7 +2531,7 @@ class Wordpress
2605
2531
  end
2606
2532
  sleep(2)
2607
2533
  puts '이미지 자동 세탁 완료 · · · '
2608
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2534
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2609
2535
  content = content5.join("\n")+'(자동생성글)'+content55
2610
2536
  puts content
2611
2537
  ##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
@@ -2750,7 +2676,7 @@ class Wordpress
2750
2676
  content = content
2751
2677
  soosick_1 = content_end
2752
2678
  else
2753
- if @data['포스트설정']['gpt'].checked?
2679
+ if @data['포스트설정']['gpt키워드'].checked?
2754
2680
  if @data['포스트설정']['gpt상단'].checked?
2755
2681
  content = content_end+"\n"+content+"\n"
2756
2682
  else
@@ -3414,7 +3340,10 @@ class Wordpress
3414
3340
  }
3415
3341
  horizontal_box{
3416
3342
  stretchy false
3343
+ grid{
3417
3344
  button('전체선택'){
3345
+ top 1
3346
+ left 1
3418
3347
  on_clicked{
3419
3348
  for n in 0..@data['키워드설정']['키워드'].length-1
3420
3349
  @data['키워드설정']['키워드'][n][0] = true
@@ -3423,7 +3352,20 @@ class Wordpress
3423
3352
  end
3424
3353
  }
3425
3354
  }
3426
- button('키워드삭제'){
3355
+ button('선택해제'){
3356
+ top 1
3357
+ left 2
3358
+ on_clicked{
3359
+ for n in 0..@data['키워드설정']['키워드'].length-1
3360
+ @data['키워드설정']['키워드'][n][0] = false
3361
+ @data['키워드설정']['키워드'] << []
3362
+ @data['키워드설정']['키워드'].pop
3363
+ end
3364
+ }
3365
+ }
3366
+ button('삭제하기'){
3367
+ top 1
3368
+ left 3
3427
3369
  on_clicked{
3428
3370
  m = Array.new
3429
3371
  for n in 0..@data['키워드설정']['키워드'].length-1
@@ -3438,6 +3380,8 @@ class Wordpress
3438
3380
  @data['키워드설정']['키워드'].delete(nil)
3439
3381
  }
3440
3382
  }
3383
+ }
3384
+
3441
3385
  @data['키워드설정']['순서사용'] = checkbox('순서사용'){
3442
3386
  stretchy false
3443
3387
  on_toggled{ |c|
@@ -3455,6 +3399,59 @@ class Wordpress
3455
3399
  }
3456
3400
  }
3457
3401
  }
3402
+ vertical_separator{
3403
+ stretchy false
3404
+ }
3405
+ horizontal_box{
3406
+ stretchy false
3407
+ grid{
3408
+ @data['포스트설정']['gpt키워드'] = checkbox('GPT 키워드 기반 글 생성'){
3409
+ top 1
3410
+ left 0
3411
+ #enabled false # 기본적으로 비활성화
3412
+ on_toggled {
3413
+ if @data['포스트설정']['gpt키워드'].checked?
3414
+ @data['포스트설정']['gpt상단'].enabled = true # '내용투명' 활성화
3415
+ @data['포스트설정']['gpt하단'].enabled = true # '내용투명' 활성화
3416
+ else
3417
+ @data['포스트설정']['gpt상단'].checked = false # 체크 해제
3418
+ @data['포스트설정']['gpt상단'].enabled = false # 비활성화
3419
+ @data['포스트설정']['gpt하단'].checked = false # 체크 해제
3420
+ @data['포스트설정']['gpt하단'].enabled = false # 비활성화
3421
+ end
3422
+ }
3423
+
3424
+ }
3425
+
3426
+ @data['포스트설정']['gpt상단'] = checkbox('원고 위에 넣기'){
3427
+ top 1
3428
+ left 1
3429
+ enabled false # 기본적으로 비활성화
3430
+ on_toggled{
3431
+ if @data['포스트설정']['gpt상단'].checked?
3432
+ @data['포스트설정']['gpt하단'].checked = false
3433
+ end
3434
+ }
3435
+ }
3436
+
3437
+ @data['포스트설정']['gpt하단'] = checkbox('원고 아래 넣기'){
3438
+ top 1
3439
+ left 2
3440
+ enabled false # 기본적으로 비활성화
3441
+ on_toggled{
3442
+ if @data['포스트설정']['gpt하단'].checked?
3443
+ @data['포스트설정']['gpt상단'].checked = false
3444
+ end
3445
+ }
3446
+ }
3447
+ } }
3448
+ horizontal_box{
3449
+ stretchy false
3450
+ grid{
3451
+ label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
3452
+ } } }
3453
+
3454
+
3458
3455
  table{
3459
3456
  checkbox_column('선택'){
3460
3457
  editable true
@@ -3465,7 +3462,9 @@ class Wordpress
3465
3462
 
3466
3463
  cell_rows @data['키워드설정']['키워드']
3467
3464
  }
3468
-
3465
+
3466
+
3467
+
3469
3468
  }
3470
3469
  vertical_separator{
3471
3470
  stretchy false
@@ -3494,7 +3493,10 @@ class Wordpress
3494
3493
  }
3495
3494
  horizontal_box{
3496
3495
  stretchy false
3496
+ grid{
3497
3497
  button('전체선택'){
3498
+ top 1
3499
+ left 1
3498
3500
  on_clicked{
3499
3501
  for n in 0..@data['제목설정']['제목'].length-1
3500
3502
  @data['제목설정']['제목'][n][0] = true
@@ -3503,7 +3505,20 @@ class Wordpress
3503
3505
  end
3504
3506
  }
3505
3507
  }
3506
- button('제목삭제'){
3508
+ button('선택해제'){
3509
+ top 1
3510
+ left 2
3511
+ on_clicked{
3512
+ for n in 0..@data['제목설정']['제목'].length-1
3513
+ @data['제목설정']['제목'][n][0] = false
3514
+ @data['제목설정']['제목'] << []
3515
+ @data['제목설정']['제목'].pop
3516
+ end
3517
+ }
3518
+ }
3519
+ button('삭제하기'){
3520
+ top 1
3521
+ left 3
3507
3522
  on_clicked{
3508
3523
  m = Array.new
3509
3524
  for n in 0..@data['제목설정']['제목'].length-1
@@ -3518,6 +3533,7 @@ class Wordpress
3518
3533
  @data['제목설정']['제목'].delete(nil)
3519
3534
  }
3520
3535
  }
3536
+ }
3521
3537
  @data['제목설정']['순서사용'] = checkbox('순서사용'){
3522
3538
  stretchy false
3523
3539
  on_toggled{ |c|
@@ -3535,6 +3551,23 @@ class Wordpress
3535
3551
  }
3536
3552
  }
3537
3553
  }
3554
+ vertical_separator{
3555
+ stretchy false
3556
+ }
3557
+ horizontal_box{
3558
+ stretchy false
3559
+ grid{
3560
+ @data['포스트설정']['gpt제목'] = checkbox('제목을 이용해 GPT로 비슷한 제목 생성'){
3561
+
3562
+
3563
+ }}}
3564
+ horizontal_box{
3565
+ stretchy false
3566
+ grid{
3567
+ label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
3568
+ } } }
3569
+
3570
+
3538
3571
  table{
3539
3572
  checkbox_column('선택'){
3540
3573
  editable true
@@ -3545,6 +3578,7 @@ class Wordpress
3545
3578
 
3546
3579
  cell_rows @data['제목설정']['제목']
3547
3580
  }
3581
+
3548
3582
 
3549
3583
  }
3550
3584
  vertical_separator{
@@ -3572,7 +3606,10 @@ class Wordpress
3572
3606
  }
3573
3607
  horizontal_box{
3574
3608
  stretchy false
3609
+ grid{
3575
3610
  button('전체선택'){
3611
+ top 1
3612
+ left 1
3576
3613
  on_clicked{
3577
3614
  for n in 0..@data['내용설정']['내용'].length-1
3578
3615
  @data['내용설정']['내용'][n][0] = true
@@ -3581,7 +3618,20 @@ class Wordpress
3581
3618
  end
3582
3619
  }
3583
3620
  }
3584
- button('내용삭제'){
3621
+ button('선택해제'){
3622
+ top 1
3623
+ left 2
3624
+ on_clicked{
3625
+ for n in 0..@data['내용설정']['내용'].length-1
3626
+ @data['내용설정']['내용'][n][0] = false
3627
+ @data['내용설정']['내용'] << []
3628
+ @data['내용설정']['내용'].pop
3629
+ end
3630
+ }
3631
+ }
3632
+ button('삭제하기'){
3633
+ top 1
3634
+ left 3
3585
3635
  on_clicked{
3586
3636
  m = Array.new
3587
3637
  for n in 0..@data['내용설정']['내용'].length-1
@@ -3596,6 +3646,7 @@ class Wordpress
3596
3646
  @data['내용설정']['내용'].delete(nil)
3597
3647
  }
3598
3648
  }
3649
+ }
3599
3650
  @data['내용설정']['순서사용'] = checkbox('순서사용'){
3600
3651
  stretchy false
3601
3652
  on_toggled{ |c|
@@ -3613,6 +3664,22 @@ class Wordpress
3613
3664
  }
3614
3665
  }
3615
3666
  }
3667
+ vertical_separator{
3668
+ stretchy false
3669
+ }
3670
+ horizontal_box{
3671
+ stretchy false
3672
+ grid{
3673
+ @data['포스트설정']['gpt내용'] = checkbox('내용파일을 이용해 GPT로 글 변형'){
3674
+
3675
+
3676
+ }}}
3677
+ horizontal_box{
3678
+ stretchy false
3679
+ grid{
3680
+ label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
3681
+ } } }
3682
+
3616
3683
  table{
3617
3684
  checkbox_column('선택'){
3618
3685
  editable true
@@ -3630,8 +3697,8 @@ class Wordpress
3630
3697
  stretchy false
3631
3698
  text "내용폴더경로 ex)C:\\내용\\폴더1"
3632
3699
  }
3633
- button('폴더째로불러오기'){
3634
- stretchy false
3700
+ button('폴더째로 불러오기'){
3701
+
3635
3702
  on_clicked{
3636
3703
  path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3637
3704
  Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
@@ -3729,7 +3796,7 @@ class Wordpress
3729
3796
  text "사진폴더경로 ex)C:\\사진\\폴더2"
3730
3797
  }
3731
3798
  button('폴더째로불러오기'){
3732
- stretchy false
3799
+
3733
3800
  on_clicked{
3734
3801
  path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3735
3802
  Dir.entries(@data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')).each do |file|
@@ -3982,6 +4049,18 @@ class Wordpress
3982
4049
  @data['포스트설정']['제목에키워드삽입'] = checkbox('제목에 키워드 삽입'){
3983
4050
  top 2
3984
4051
  left 0
4052
+ #enabled false # 기본적으로 비활성화
4053
+ on_toggled {
4054
+ if @data['포스트설정']['제목에키워드삽입'].checked?
4055
+ @data['포스트설정']['제목앞'].enabled = true # '내용투명' 활성화
4056
+ @data['포스트설정']['제목뒤'].enabled = true # '내용투명' 활성화
4057
+ else
4058
+ @data['포스트설정']['제목앞'].checked = false # 체크 해제
4059
+ @data['포스트설정']['제목앞'].enabled = false # 비활성화
4060
+ @data['포스트설정']['제목뒤'].checked = false # 체크 해제
4061
+ @data['포스트설정']['제목뒤'].enabled = false # 비활성화
4062
+ end
4063
+ }
3985
4064
  }
3986
4065
  @data['포스트설정']['제목에키워드삽입숫자1'] = entry(){
3987
4066
  top 2
@@ -4004,6 +4083,7 @@ class Wordpress
4004
4083
  @data['포스트설정']['제목앞'] = checkbox('제목에 키워드 삽입 제목 앞'){
4005
4084
  top 3
4006
4085
  left 3
4086
+ enabled false # 기본적으로 비활성화
4007
4087
  on_toggled{
4008
4088
  if @data['포스트설정']['제목앞'].checked? == true
4009
4089
  if @data['포스트설정']['제목뒤'].checked?
@@ -4019,6 +4099,7 @@ class Wordpress
4019
4099
  @data['포스트설정']['제목뒤'] = checkbox('제목에 키워드 삽입 제목 뒤'){
4020
4100
  top 4
4021
4101
  left 3
4102
+ enabled false # 기본적으로 비활성화
4022
4103
  on_toggled{
4023
4104
  if @data['포스트설정']['제목뒤'].checked? == true
4024
4105
  if @data['포스트설정']['제목앞'].checked?
@@ -4027,26 +4108,51 @@ class Wordpress
4027
4108
  end
4028
4109
  }
4029
4110
  }
4030
- @data['포스트설정']['제목내용설정'] = checkbox('내용의 문장을 제목으로 설정'){
4111
+ @data['포스트설정']['특수문자'] = checkbox('제목에 키워드 삽입 특수문자 삽입'){
4031
4112
  top 4
4032
4113
  left 0
4033
4114
  }
4034
-
4035
- @data['포스트설정']['특수문자'] = checkbox('제목에 키워드 삽입 시 특수문자 삽입'){
4115
+ @data['포스트설정']['제목을랜덤'] = checkbox('제목을 랜덤 단어 조합으로 자동 입력'){
4036
4116
  top 5
4037
4117
  left 0
4118
+ on_toggled{
4119
+ if @data['포스트설정']['제목을랜덤'].checked? == true
4120
+ if @data['포스트설정']['제목내용설정'].checked?
4121
+ @data['포스트설정']['제목내용설정'].checked = false
4122
+ end
4123
+ end
4124
+ }
4038
4125
  }
4039
- @data['포스트설정']['제목을랜덤'] = checkbox('제목을 랜덤 단어 조합으로 자동 입력'){
4126
+ @data['포스트설정']['제목내용설정'] = checkbox('내용의 문장을 제목으로 설정'){
4040
4127
  top 6
4041
4128
  left 0
4129
+ on_toggled{
4130
+ if @data['포스트설정']['제목내용설정'].checked? == true
4131
+ if @data['포스트설정']['제목을랜덤'].checked?
4132
+ @data['포스트설정']['제목을랜덤'].checked = false
4133
+ end
4134
+ end
4135
+ }
4042
4136
  }
4043
4137
  @data['포스트설정']['내용키워드삽입'] = checkbox('내용 키워드 삽입'){
4044
4138
  top 7
4045
4139
  left 0
4140
+ on_toggled {
4141
+ if @data['포스트설정']['내용키워드삽입'].checked?
4142
+ @data['포스트설정']['키워드삽입'].enabled = true # '내용투명' 활성화
4143
+ @data['포스트설정']['키워드삽입시링크'].enabled = true # '내용투명' 활성화
4144
+ else
4145
+ @data['포스트설정']['키워드삽입'].checked = false # 체크 해제
4146
+ @data['포스트설정']['키워드삽입'].enabled = false # 비활성화
4147
+ @data['포스트설정']['키워드삽입시링크'].text = 'URL' # 기본 텍스트 설정
4148
+ @data['포스트설정']['키워드삽입시링크'].enabled = false # 비활성화
4149
+ end
4150
+ }
4046
4151
  }
4047
4152
  @data['포스트설정']['키워드삽입시작숫자'] = entry(){
4048
4153
  top 7
4049
4154
  left 1
4155
+
4050
4156
  text '최소수량'
4051
4157
  }
4052
4158
  label('~'){
@@ -4059,63 +4165,61 @@ class Wordpress
4059
4165
  text '최대수량'
4060
4166
  }
4061
4167
  @data['포스트설정']['키워드삽입'] = checkbox('내용 키워드 삽입시 링크 삽입'){
4168
+ enabled false # 기본적으로 비활성화
4062
4169
  top 8
4063
4170
  left 0
4064
4171
  }
4065
4172
  @data['포스트설정']['키워드삽입시링크'] = entry(){
4173
+ enabled false # 기본적으로 비활성화
4066
4174
  top 8
4067
4175
  left 1
4068
4176
  text 'URL'
4069
4177
  }
4070
- @data['포스트설정']['내용을자동생성'] = checkbox('내용을 키워드 기반으로 자동 생성해서 포스팅'){
4178
+ @data['포스트설정']['내용을자동생성'] = checkbox('키워드기반 생성으로만 등록(GPT 사용시 자체 생성)'){
4071
4179
  top 9
4072
4180
  left 0
4073
4181
  on_toggled{
4074
4182
  if @data['포스트설정']['내용을자동생성'].checked?
4075
- if @data['포스트설정']['내용과자동생성'].checked?
4076
- @data['포스트설정']['내용과자동생성'].checked = false
4077
- end
4183
+ @data['포스트설정']['내용과자동생성'].checked = false
4184
+ @data['포스트설정']['내용투명'].checked = false
4185
+ @data['포스트설정']['자동글 수식에 입력'].checked = false
4186
+
4078
4187
  end
4079
4188
  }
4080
4189
  }
4081
4190
 
4082
- @data['포스트설정']['gpt'] = checkbox('내용을 키워드 기반의 GPT로 생성해서 포스팅'){
4083
- top 10
4084
- left 0
4085
- }
4086
-
4087
- @data['포스트설정']['api_key'] = entry(){
4088
- top 10
4089
- left 1
4090
- text 'api key'
4091
- }
4092
-
4093
- @data['포스트설정']['gpt상단'] = checkbox('원고내용 위에 넣기'){
4094
- top 10
4095
- left 3
4096
- }
4097
4191
 
4098
- @data['포스트설정']['gpt하단'] = checkbox('원고내용 아래에 넣기'){
4099
- top 11
4100
- left 3
4101
- }
4192
+
4102
4193
 
4103
4194
  aa1 = 2
4104
- @data['포스트설정']['내용과자동생성'] = checkbox('내용을 내용 파일 + 자동 생성 조합으로 포스팅'){
4195
+ @data['포스트설정']['내용과자동생성'] = checkbox('내용파일+키워드기반 생성 등록(GPT 사용시 자체 생성)') {
4105
4196
  top 10 + aa1
4106
4197
  left 0
4107
- on_toggled{
4108
- if @data['포스트설정']['내용과자동생성'].checked?
4109
- if @data['포스트설정']['내용을자동생성'].checked?
4110
- @data['포스트설정']['내용을자동생성'].checked = false
4111
- end
4112
- end
4198
+ on_toggled {
4199
+ if @data['포스트설정']['내용과자동생성'].checked?
4200
+ @data['포스트설정']['내용을자동생성'].checked = false
4201
+ @data['포스트설정']['내용투명'].enabled = true # '내용투명' 활성화
4202
+ @data['포스트설정']['자동글 수식에 입력'].enabled = true # '내용투명' 활성화
4203
+ else
4204
+ @data['포스트설정']['내용투명'].checked = false # 체크 해제
4205
+ @data['포스트설정']['내용투명'].enabled = false # 비활성화
4206
+ @data['포스트설정']['자동글 수식에 입력'].checked = false # 체크 해제
4207
+ @data['포스트설정']['자동글 수식에 입력'].enabled = false # 비활성화
4208
+ end
4113
4209
  }
4114
- }
4115
- @data['포스트설정']['내용투명'] = checkbox('키워드 기반 자동 생성글 안보이게 처리'){
4116
- top 11+ aa1
4210
+ }
4211
+
4212
+ @data['포스트설정']['내용투명'] = checkbox('키워드 기반 자동 생성글 안보이게 처리') {
4213
+ top 11 + aa1
4117
4214
  left 0
4118
- }
4215
+ enabled false # 기본적으로 비활성화
4216
+ on_toggled {
4217
+ if @data['포스트설정']['내용투명'].checked?
4218
+ @data['포스트설정']['내용을자동생성'].checked = false
4219
+ @data['포스트설정']['자동글 수식에 입력'].checked = false
4220
+ end
4221
+ }
4222
+ }
4119
4223
  @data['포스트설정']['내용자동변경'] = checkbox('내용에 단어들을 자동 변경'){
4120
4224
  top 12+ aa1
4121
4225
  left 0
@@ -4143,6 +4247,18 @@ class Wordpress
4143
4247
  @data['포스트설정']['내용사진자동삽입'] = checkbox('내용 사진 자동 삽입'){
4144
4248
  top 13+ aa1
4145
4249
  left 0
4250
+ #enabled false # 기본적으로 비활성화
4251
+ on_toggled {
4252
+ if @data['포스트설정']['내용사진자동삽입'].checked?
4253
+ @data['포스트설정']['내용사진링크'].enabled = true # '내용투명' 활성화
4254
+ @data['포스트설정']['내용사진링크값'].enabled = true # '내용투명' 활성화
4255
+ else
4256
+ @data['포스트설정']['내용사진링크'].checked = false # 체크 해제
4257
+ @data['포스트설정']['내용사진링크'].enabled = false # 비활성화
4258
+ @data['포스트설정']['내용사진링크값'].text = 'URL' # 기본 텍스트 설정
4259
+ @data['포스트설정']['내용사진링크값'].enabled = false # 비활성화
4260
+ end
4261
+ }
4146
4262
  }
4147
4263
  @data['포스트설정']['내용사진자동삽입시작숫자'] = entry(){
4148
4264
  top 13+ aa1
@@ -4160,15 +4276,28 @@ class Wordpress
4160
4276
  }
4161
4277
 
4162
4278
  @data['포스트설정']['내용사진링크'] = checkbox('내용 사진 자동 삽입시 링크 삽입'){
4279
+ enabled false # 기본적으로 비활성화
4163
4280
  top 14+ aa1
4164
4281
  left 0
4165
4282
  }
4166
4283
 
4167
4284
  @data['포스트설정']['내용사진링크값'] = entry(){
4285
+ enabled false # 기본적으로 비활성화
4168
4286
  top 14+ aa1
4169
4287
  left 1
4170
4288
  text 'URL'
4171
4289
  }
4290
+
4291
+ @data['포스트설정']['ChatGPT사용'] = checkbox('Chat GPT 사용하기'){
4292
+ top 15+ aa1
4293
+ left 0
4294
+ }
4295
+
4296
+ @data['포스트설정']['api_key'] = entry(){
4297
+ top 15+ aa1
4298
+ left 1
4299
+ text 'api key 입력 필수!!'
4300
+ }
4172
4301
  }
4173
4302
  }
4174
4303
 
@@ -4359,6 +4488,22 @@ class Wordpress
4359
4488
  @data['포스트설정']['막글삽입'] = checkbox('내용 하단에 막글 삽입'){
4360
4489
  top 6
4361
4490
  left 0
4491
+ #enabled false # 기본적으로 비활성화
4492
+ on_toggled {
4493
+ if @data['포스트설정']['막글삽입'].checked?
4494
+ @data['포스트설정']['막글투명'].enabled = true # '내용투명' 활성화
4495
+ @data['포스트설정']['막글그대로'].enabled = true # '내용투명' 활성화
4496
+ @data['포스트설정']['막글 수식에 입력'].enabled = true # '내용투명' 활성화
4497
+
4498
+ else
4499
+ @data['포스트설정']['막글투명'].checked = false # 체크 해제
4500
+ @data['포스트설정']['막글투명'].enabled = false # 비활성화
4501
+ @data['포스트설정']['막글그대로'].checked = false # 체크 해제
4502
+ @data['포스트설정']['막글그대로'].enabled = false # 비활성화
4503
+ @data['포스트설정']['막글 수식에 입력'].checked = false # 체크 해제
4504
+ @data['포스트설정']['막글 수식에 입력'].enabled = false # 비활성화
4505
+ end
4506
+ }
4362
4507
  }
4363
4508
  @data['포스트설정']['막글삽입시작숫자'] = entry{
4364
4509
  top 6
@@ -4388,10 +4533,12 @@ class Wordpress
4388
4533
  @data['포스트설정']['막글투명'] = checkbox('막글 안보이게 처리'){
4389
4534
  top 7
4390
4535
  left 0
4536
+ enabled false # 기본적으로 비활성화
4391
4537
  }
4392
4538
  @data['포스트설정']['막글그대로'] = checkbox('막글 그대로 입력'){
4393
4539
  top 7
4394
4540
  left 1
4541
+ enabled false # 기본적으로 비활성화
4395
4542
  }
4396
4543
 
4397
4544
  @data['포스트설정']['태그삽입1'] = checkbox('태그삽입'){
@@ -4416,11 +4563,19 @@ class Wordpress
4416
4563
  @data['포스트설정']['자동글 수식에 입력'] = checkbox('자동글 수식에 입력'){
4417
4564
  top 9
4418
4565
  left 0
4566
+ enabled false # 기본적으로 비활성화
4567
+ on_toggled {
4568
+ if @data['포스트설정']['자동글 수식에 입력'].checked?
4569
+ @data['포스트설정']['내용을자동생성'].checked = false
4570
+ @data['포스트설정']['내용투명'].checked = false
4571
+ end
4572
+ }
4419
4573
  }
4420
4574
 
4421
4575
  @data['포스트설정']['막글 수식에 입력'] = checkbox('막글 수식에 입력'){
4422
4576
  top 9
4423
4577
  left 1
4578
+ enabled false # 기본적으로 비활성화
4424
4579
  }
4425
4580
 
4426
4581
 
@@ -4503,10 +4658,22 @@ class Wordpress
4503
4658
  @data['포스트설정']['테더링'] = checkbox('테더링 IP 사용'){
4504
4659
  top 15
4505
4660
  left 0
4661
+ on_toggled{
4662
+ if @data['포스트설정']['테더링'].checked?
4663
+ @data['포스트설정']['프록시'].checked = false
4664
+
4665
+ end
4666
+ }
4506
4667
  }
4507
4668
  @data['포스트설정']['프록시'] = checkbox('프록시 IP 사용'){
4508
4669
  top 15
4509
4670
  left 1
4671
+ on_toggled{
4672
+ if @data['포스트설정']['프록시'].checked?
4673
+ @data['포스트설정']['테더링'].checked = false
4674
+
4675
+ end
4676
+ }
4510
4677
  }
4511
4678
  button('프록시 IP 파일 불러오기'){
4512
4679
  top 15