cafe_basics 0.0.5 → 0.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cafe_basics.rb +540 -364
  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]
@@ -807,11 +782,20 @@ class Naver
807
782
  sleep(3)
808
783
  @driver.action.key_down(:up).key_up(:up).perform #x탭
809
784
  sleep(1)
785
+ begin
786
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
787
+ #요소가 나타날 때까지 60초 동안 기다립니다.
788
+ wait.until { @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]') }
789
+ sleep(1)
810
790
  @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]').click
791
+ sleep(1)
811
792
  @driver.action.send_keys(title).perform
812
793
  sleep(1)
813
794
  @driver.action.key_down(:enter).key_up(:enter).perform #엔터
814
795
  sleep(1)
796
+ rescue
797
+ @driver.action.key_down(:down).key_up(:down).perform
798
+ end
815
799
 
816
800
  elsif i2.to_s.include?('<inyonggoo')
817
801
  if i2.text == ''
@@ -1649,95 +1633,21 @@ class Wordpress
1649
1633
  end
1650
1634
  end
1651
1635
 
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
1636
 
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
1637
+
1638
+ #def chrome_start(url, user_id, user_pw)
1639
+ # @url = url
1640
+ # @user_id = user_id
1641
+ # @user_pw = user_pw
1642
+ # begin
1643
+ # Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
1644
+ # @driver = Selenium::WebDriver.for :chrome
1645
+ # rescue
1646
+ # @driver = Selenium::WebDriver.for :chrome
1647
+ # end
1648
+ #end
1649
+
1650
+
1741
1651
 
1742
1652
  def auto_image
1743
1653
  begin
@@ -1966,8 +1876,7 @@ class Wordpress
1966
1876
  @inumber2 = 0
1967
1877
  @video = Array.new
1968
1878
 
1969
- price_hash = Hash.new
1970
-
1879
+
1971
1880
  while true
1972
1881
  for n in 0..@data['table'].length-1
1973
1882
  @data['table'][n][10] = 0
@@ -2060,6 +1969,13 @@ class Wordpress
2060
1969
  end
2061
1970
  end
2062
1971
  end
1972
+
1973
+ if @data['포스트설정']['gpt제목'].checked?
1974
+ chat = Chat_title.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'))
1975
+ gpt_text1 = chat.message(title)
1976
+ title = gpt_text1.to_s
1977
+ end
1978
+
2063
1979
  @data['table'][index][-1] = 5
2064
1980
  @data['table'] << []
2065
1981
  @data['table'].pop
@@ -2097,6 +2013,25 @@ class Wordpress
2097
2013
  end
2098
2014
  end
2099
2015
  end
2016
+
2017
+
2018
+ if @data['포스트설정']['gpt내용'].checked?
2019
+ api_key = @data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8')
2020
+ #key_change = @data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8')
2021
+ #imotcon_change = @data['포스트설정']['스티커로변경단어'].text.to_s.force_encoding('utf-8')
2022
+ #template_change = @data['포스트설정']['내템플릿변경단어'].text.to_s.force_encoding('utf-8')
2023
+ #ttdanar_change = @data['포스트설정']['단어링크적용단어'].text.to_s.force_encoding('utf-8')
2024
+ #sajine_change = @data['포스트설정']['단어사진으로변경단어'].text.to_s.force_encoding('utf-8')
2025
+ #mov_change = @data['포스트설정']['영상으로변경단어'].text.to_s.force_encoding('utf-8')
2026
+ #map_change = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8')
2027
+ #inyong9_change = @data['포스트설정']['인용구변경단어'].text.to_s.force_encoding('utf-8')
2028
+
2029
+
2030
+ chat = Chat_content.new(api_key)
2031
+ gpt_text3 = chat.message(content)
2032
+ content = gpt_text3.to_s
2033
+ end
2034
+
2100
2035
  content_tag = content.split('@##@')[1]
2101
2036
  content = content.split('@##@')[0]
2102
2037
  @data['table'][index][-1] = 15
@@ -2295,7 +2230,7 @@ class Wordpress
2295
2230
  @data['table'][index][-1] = 50
2296
2231
  @data['table'] << []
2297
2232
  @data['table'].pop
2298
- if @data['포스트설정']['gpt'].checked?
2233
+ if @data['포스트설정']['gpt키워드'].checked?
2299
2234
  chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'))
2300
2235
  gpt_text = chat.message(keyword)
2301
2236
  content = content + "\n(자동생성글)\n" + gpt_text
@@ -2316,7 +2251,7 @@ class Wordpress
2316
2251
  joongbok_check = 0
2317
2252
  counter10 = 0
2318
2253
  while joongbok_check == 0
2319
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2254
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2320
2255
  content22 = content.split("(자동생성글)")[1].split("\n")
2321
2256
  else
2322
2257
  content22 = content.split("\n")
@@ -2340,12 +2275,12 @@ class Wordpress
2340
2275
  content2 = content.split("\n")
2341
2276
  end
2342
2277
 
2343
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2278
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2344
2279
  content2 = content.split("(자동생성글)")[1].split("\n")
2345
2280
  position.pop
2346
2281
  end
2347
2282
 
2348
- if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt'].checked? == false
2283
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt키워드'].checked? == false
2349
2284
  content2 = content.split("\n")
2350
2285
  end
2351
2286
 
@@ -2391,7 +2326,7 @@ class Wordpress
2391
2326
  content = content3.join("\n")
2392
2327
  end
2393
2328
 
2394
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2329
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2395
2330
  content2.each_with_index do |con, index|
2396
2331
  if position.include?(index)
2397
2332
  insert_keyword_text = keyword.to_s
@@ -2421,7 +2356,7 @@ class Wordpress
2421
2356
  end
2422
2357
  end
2423
2358
 
2424
- if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt'].checked? == false
2359
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt키워드'].checked? == false
2425
2360
  begin
2426
2361
  content2.each_with_index do |con, index|
2427
2362
  if position.include?(index)
@@ -2516,7 +2451,7 @@ class Wordpress
2516
2451
  end
2517
2452
  end
2518
2453
 
2519
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2454
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2520
2455
  if @data['포스트설정']['자동글 수식에 입력'].checked?
2521
2456
  content5 = content.split("(자동생성글)")[0].to_s.split("\n")
2522
2457
  content55 = content.split("(자동생성글)")[1].to_s
@@ -2546,9 +2481,9 @@ class Wordpress
2546
2481
  end
2547
2482
  end
2548
2483
 
2549
- position = position.sort
2484
+ position = position.sort
2550
2485
  ##여기서부터 이미지 순서대로 안되서 변경####-------------------------------------------------------------------------------
2551
- # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2486
+ # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2552
2487
  # image_url22 = get_image_file().force_encoding('utf-8')
2553
2488
  # end
2554
2489
 
@@ -2566,7 +2501,7 @@ class Wordpress
2566
2501
  # end
2567
2502
  # end
2568
2503
 
2569
- # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2504
+ # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2570
2505
  # content = content5.join("\n")+'(자동생성글)'+content55
2571
2506
  # iconv = Iconv.new('UTF-8', 'ASCII-8BIT')
2572
2507
  # content = iconv.iconv(content)
@@ -2586,7 +2521,7 @@ class Wordpress
2586
2521
  ###여기까지 이미지 순서대로 안되서 변경##-------------------------------------------------------------------------------
2587
2522
 
2588
2523
  ##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
2589
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2524
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2590
2525
  sleep(2)
2591
2526
  puts '이미지 자동 세탁 중 · · · '
2592
2527
  end
@@ -2605,7 +2540,7 @@ class Wordpress
2605
2540
  end
2606
2541
  sleep(2)
2607
2542
  puts '이미지 자동 세탁 완료 · · · '
2608
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2543
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2609
2544
  content = content5.join("\n")+'(자동생성글)'+content55
2610
2545
  puts content
2611
2546
  ##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
@@ -2750,7 +2685,7 @@ class Wordpress
2750
2685
  content = content
2751
2686
  soosick_1 = content_end
2752
2687
  else
2753
- if @data['포스트설정']['gpt'].checked?
2688
+ if @data['포스트설정']['gpt키워드'].checked?
2754
2689
  if @data['포스트설정']['gpt상단'].checked?
2755
2690
  content = content_end+"\n"+content+"\n"
2756
2691
  else
@@ -3414,7 +3349,10 @@ class Wordpress
3414
3349
  }
3415
3350
  horizontal_box{
3416
3351
  stretchy false
3352
+ grid{
3417
3353
  button('전체선택'){
3354
+ top 1
3355
+ left 1
3418
3356
  on_clicked{
3419
3357
  for n in 0..@data['키워드설정']['키워드'].length-1
3420
3358
  @data['키워드설정']['키워드'][n][0] = true
@@ -3423,7 +3361,20 @@ class Wordpress
3423
3361
  end
3424
3362
  }
3425
3363
  }
3426
- button('키워드삭제'){
3364
+ button('선택해제'){
3365
+ top 1
3366
+ left 2
3367
+ on_clicked{
3368
+ for n in 0..@data['키워드설정']['키워드'].length-1
3369
+ @data['키워드설정']['키워드'][n][0] = false
3370
+ @data['키워드설정']['키워드'] << []
3371
+ @data['키워드설정']['키워드'].pop
3372
+ end
3373
+ }
3374
+ }
3375
+ button('삭제하기'){
3376
+ top 1
3377
+ left 3
3427
3378
  on_clicked{
3428
3379
  m = Array.new
3429
3380
  for n in 0..@data['키워드설정']['키워드'].length-1
@@ -3438,6 +3389,8 @@ class Wordpress
3438
3389
  @data['키워드설정']['키워드'].delete(nil)
3439
3390
  }
3440
3391
  }
3392
+ }
3393
+
3441
3394
  @data['키워드설정']['순서사용'] = checkbox('순서사용'){
3442
3395
  stretchy false
3443
3396
  on_toggled{ |c|
@@ -3455,6 +3408,59 @@ class Wordpress
3455
3408
  }
3456
3409
  }
3457
3410
  }
3411
+ vertical_separator{
3412
+ stretchy false
3413
+ }
3414
+ horizontal_box{
3415
+ stretchy false
3416
+ grid{
3417
+ @data['포스트설정']['gpt키워드'] = checkbox('GPT 키워드 기반 글 생성'){
3418
+ top 1
3419
+ left 0
3420
+ #enabled false # 기본적으로 비활성화
3421
+ on_toggled {
3422
+ if @data['포스트설정']['gpt키워드'].checked?
3423
+ @data['포스트설정']['gpt상단'].enabled = true # '내용투명' 활성화
3424
+ @data['포스트설정']['gpt하단'].enabled = true # '내용투명' 활성화
3425
+ else
3426
+ @data['포스트설정']['gpt상단'].checked = false # 체크 해제
3427
+ @data['포스트설정']['gpt상단'].enabled = false # 비활성화
3428
+ @data['포스트설정']['gpt하단'].checked = false # 체크 해제
3429
+ @data['포스트설정']['gpt하단'].enabled = false # 비활성화
3430
+ end
3431
+ }
3432
+
3433
+ }
3434
+
3435
+ @data['포스트설정']['gpt상단'] = checkbox('원고 위에 넣기'){
3436
+ top 1
3437
+ left 1
3438
+ enabled false # 기본적으로 비활성화
3439
+ on_toggled{
3440
+ if @data['포스트설정']['gpt상단'].checked?
3441
+ @data['포스트설정']['gpt하단'].checked = false
3442
+ end
3443
+ }
3444
+ }
3445
+
3446
+ @data['포스트설정']['gpt하단'] = checkbox('원고 아래 넣기'){
3447
+ top 1
3448
+ left 2
3449
+ enabled false # 기본적으로 비활성화
3450
+ on_toggled{
3451
+ if @data['포스트설정']['gpt하단'].checked?
3452
+ @data['포스트설정']['gpt상단'].checked = false
3453
+ end
3454
+ }
3455
+ }
3456
+ } }
3457
+ horizontal_box{
3458
+ stretchy false
3459
+ grid{
3460
+ label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
3461
+ } } }
3462
+
3463
+
3458
3464
  table{
3459
3465
  checkbox_column('선택'){
3460
3466
  editable true
@@ -3465,7 +3471,9 @@ class Wordpress
3465
3471
 
3466
3472
  cell_rows @data['키워드설정']['키워드']
3467
3473
  }
3468
-
3474
+
3475
+
3476
+
3469
3477
  }
3470
3478
  vertical_separator{
3471
3479
  stretchy false
@@ -3494,7 +3502,10 @@ class Wordpress
3494
3502
  }
3495
3503
  horizontal_box{
3496
3504
  stretchy false
3505
+ grid{
3497
3506
  button('전체선택'){
3507
+ top 1
3508
+ left 1
3498
3509
  on_clicked{
3499
3510
  for n in 0..@data['제목설정']['제목'].length-1
3500
3511
  @data['제목설정']['제목'][n][0] = true
@@ -3503,7 +3514,20 @@ class Wordpress
3503
3514
  end
3504
3515
  }
3505
3516
  }
3506
- button('제목삭제'){
3517
+ button('선택해제'){
3518
+ top 1
3519
+ left 2
3520
+ on_clicked{
3521
+ for n in 0..@data['제목설정']['제목'].length-1
3522
+ @data['제목설정']['제목'][n][0] = false
3523
+ @data['제목설정']['제목'] << []
3524
+ @data['제목설정']['제목'].pop
3525
+ end
3526
+ }
3527
+ }
3528
+ button('삭제하기'){
3529
+ top 1
3530
+ left 3
3507
3531
  on_clicked{
3508
3532
  m = Array.new
3509
3533
  for n in 0..@data['제목설정']['제목'].length-1
@@ -3518,6 +3542,7 @@ class Wordpress
3518
3542
  @data['제목설정']['제목'].delete(nil)
3519
3543
  }
3520
3544
  }
3545
+ }
3521
3546
  @data['제목설정']['순서사용'] = checkbox('순서사용'){
3522
3547
  stretchy false
3523
3548
  on_toggled{ |c|
@@ -3535,6 +3560,23 @@ class Wordpress
3535
3560
  }
3536
3561
  }
3537
3562
  }
3563
+ vertical_separator{
3564
+ stretchy false
3565
+ }
3566
+ horizontal_box{
3567
+ stretchy false
3568
+ grid{
3569
+ @data['포스트설정']['gpt제목'] = checkbox('제목을 이용해 GPT로 비슷한 제목 생성'){
3570
+
3571
+
3572
+ }}}
3573
+ horizontal_box{
3574
+ stretchy false
3575
+ grid{
3576
+ label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
3577
+ } } }
3578
+
3579
+
3538
3580
  table{
3539
3581
  checkbox_column('선택'){
3540
3582
  editable true
@@ -3545,6 +3587,7 @@ class Wordpress
3545
3587
 
3546
3588
  cell_rows @data['제목설정']['제목']
3547
3589
  }
3590
+
3548
3591
 
3549
3592
  }
3550
3593
  vertical_separator{
@@ -3572,7 +3615,10 @@ class Wordpress
3572
3615
  }
3573
3616
  horizontal_box{
3574
3617
  stretchy false
3618
+ grid{
3575
3619
  button('전체선택'){
3620
+ top 1
3621
+ left 1
3576
3622
  on_clicked{
3577
3623
  for n in 0..@data['내용설정']['내용'].length-1
3578
3624
  @data['내용설정']['내용'][n][0] = true
@@ -3581,7 +3627,20 @@ class Wordpress
3581
3627
  end
3582
3628
  }
3583
3629
  }
3584
- button('내용삭제'){
3630
+ button('선택해제'){
3631
+ top 1
3632
+ left 2
3633
+ on_clicked{
3634
+ for n in 0..@data['내용설정']['내용'].length-1
3635
+ @data['내용설정']['내용'][n][0] = false
3636
+ @data['내용설정']['내용'] << []
3637
+ @data['내용설정']['내용'].pop
3638
+ end
3639
+ }
3640
+ }
3641
+ button('삭제하기'){
3642
+ top 1
3643
+ left 3
3585
3644
  on_clicked{
3586
3645
  m = Array.new
3587
3646
  for n in 0..@data['내용설정']['내용'].length-1
@@ -3596,6 +3655,7 @@ class Wordpress
3596
3655
  @data['내용설정']['내용'].delete(nil)
3597
3656
  }
3598
3657
  }
3658
+ }
3599
3659
  @data['내용설정']['순서사용'] = checkbox('순서사용'){
3600
3660
  stretchy false
3601
3661
  on_toggled{ |c|
@@ -3613,6 +3673,22 @@ class Wordpress
3613
3673
  }
3614
3674
  }
3615
3675
  }
3676
+ vertical_separator{
3677
+ stretchy false
3678
+ }
3679
+ horizontal_box{
3680
+ stretchy false
3681
+ grid{
3682
+ @data['포스트설정']['gpt내용'] = checkbox('내용파일을 이용해 GPT로 글 변형'){
3683
+
3684
+
3685
+ }}}
3686
+ horizontal_box{
3687
+ stretchy false
3688
+ grid{
3689
+ label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
3690
+ } } }
3691
+
3616
3692
  table{
3617
3693
  checkbox_column('선택'){
3618
3694
  editable true
@@ -3630,8 +3706,8 @@ class Wordpress
3630
3706
  stretchy false
3631
3707
  text "내용폴더경로 ex)C:\\내용\\폴더1"
3632
3708
  }
3633
- button('폴더째로불러오기'){
3634
- stretchy false
3709
+ button('폴더째로 불러오기'){
3710
+
3635
3711
  on_clicked{
3636
3712
  path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3637
3713
  Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
@@ -3729,7 +3805,7 @@ class Wordpress
3729
3805
  text "사진폴더경로 ex)C:\\사진\\폴더2"
3730
3806
  }
3731
3807
  button('폴더째로불러오기'){
3732
- stretchy false
3808
+
3733
3809
  on_clicked{
3734
3810
  path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3735
3811
  Dir.entries(@data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')).each do |file|
@@ -3982,6 +4058,18 @@ class Wordpress
3982
4058
  @data['포스트설정']['제목에키워드삽입'] = checkbox('제목에 키워드 삽입'){
3983
4059
  top 2
3984
4060
  left 0
4061
+ #enabled false # 기본적으로 비활성화
4062
+ on_toggled {
4063
+ if @data['포스트설정']['제목에키워드삽입'].checked?
4064
+ @data['포스트설정']['제목앞'].enabled = true # '내용투명' 활성화
4065
+ @data['포스트설정']['제목뒤'].enabled = true # '내용투명' 활성화
4066
+ else
4067
+ @data['포스트설정']['제목앞'].checked = false # 체크 해제
4068
+ @data['포스트설정']['제목앞'].enabled = false # 비활성화
4069
+ @data['포스트설정']['제목뒤'].checked = false # 체크 해제
4070
+ @data['포스트설정']['제목뒤'].enabled = false # 비활성화
4071
+ end
4072
+ }
3985
4073
  }
3986
4074
  @data['포스트설정']['제목에키워드삽입숫자1'] = entry(){
3987
4075
  top 2
@@ -4004,6 +4092,7 @@ class Wordpress
4004
4092
  @data['포스트설정']['제목앞'] = checkbox('제목에 키워드 삽입 제목 앞'){
4005
4093
  top 3
4006
4094
  left 3
4095
+ enabled false # 기본적으로 비활성화
4007
4096
  on_toggled{
4008
4097
  if @data['포스트설정']['제목앞'].checked? == true
4009
4098
  if @data['포스트설정']['제목뒤'].checked?
@@ -4019,6 +4108,7 @@ class Wordpress
4019
4108
  @data['포스트설정']['제목뒤'] = checkbox('제목에 키워드 삽입 제목 뒤'){
4020
4109
  top 4
4021
4110
  left 3
4111
+ enabled false # 기본적으로 비활성화
4022
4112
  on_toggled{
4023
4113
  if @data['포스트설정']['제목뒤'].checked? == true
4024
4114
  if @data['포스트설정']['제목앞'].checked?
@@ -4027,26 +4117,51 @@ class Wordpress
4027
4117
  end
4028
4118
  }
4029
4119
  }
4030
- @data['포스트설정']['제목내용설정'] = checkbox('내용의 문장을 제목으로 설정'){
4120
+ @data['포스트설정']['특수문자'] = checkbox('제목에 키워드 삽입 특수문자 삽입'){
4031
4121
  top 4
4032
4122
  left 0
4033
4123
  }
4034
-
4035
- @data['포스트설정']['특수문자'] = checkbox('제목에 키워드 삽입 시 특수문자 삽입'){
4124
+ @data['포스트설정']['제목을랜덤'] = checkbox('제목을 랜덤 단어 조합으로 자동 입력'){
4036
4125
  top 5
4037
4126
  left 0
4127
+ on_toggled{
4128
+ if @data['포스트설정']['제목을랜덤'].checked? == true
4129
+ if @data['포스트설정']['제목내용설정'].checked?
4130
+ @data['포스트설정']['제목내용설정'].checked = false
4131
+ end
4132
+ end
4133
+ }
4038
4134
  }
4039
- @data['포스트설정']['제목을랜덤'] = checkbox('제목을 랜덤 단어 조합으로 자동 입력'){
4135
+ @data['포스트설정']['제목내용설정'] = checkbox('내용의 문장을 제목으로 설정'){
4040
4136
  top 6
4041
4137
  left 0
4138
+ on_toggled{
4139
+ if @data['포스트설정']['제목내용설정'].checked? == true
4140
+ if @data['포스트설정']['제목을랜덤'].checked?
4141
+ @data['포스트설정']['제목을랜덤'].checked = false
4142
+ end
4143
+ end
4144
+ }
4042
4145
  }
4043
4146
  @data['포스트설정']['내용키워드삽입'] = checkbox('내용 키워드 삽입'){
4044
4147
  top 7
4045
4148
  left 0
4149
+ on_toggled {
4150
+ if @data['포스트설정']['내용키워드삽입'].checked?
4151
+ @data['포스트설정']['키워드삽입'].enabled = true # '내용투명' 활성화
4152
+ @data['포스트설정']['키워드삽입시링크'].enabled = true # '내용투명' 활성화
4153
+ else
4154
+ @data['포스트설정']['키워드삽입'].checked = false # 체크 해제
4155
+ @data['포스트설정']['키워드삽입'].enabled = false # 비활성화
4156
+ @data['포스트설정']['키워드삽입시링크'].text = 'URL' # 기본 텍스트 설정
4157
+ @data['포스트설정']['키워드삽입시링크'].enabled = false # 비활성화
4158
+ end
4159
+ }
4046
4160
  }
4047
4161
  @data['포스트설정']['키워드삽입시작숫자'] = entry(){
4048
4162
  top 7
4049
4163
  left 1
4164
+
4050
4165
  text '최소수량'
4051
4166
  }
4052
4167
  label('~'){
@@ -4059,63 +4174,61 @@ class Wordpress
4059
4174
  text '최대수량'
4060
4175
  }
4061
4176
  @data['포스트설정']['키워드삽입'] = checkbox('내용 키워드 삽입시 링크 삽입'){
4177
+ enabled false # 기본적으로 비활성화
4062
4178
  top 8
4063
4179
  left 0
4064
4180
  }
4065
4181
  @data['포스트설정']['키워드삽입시링크'] = entry(){
4182
+ enabled false # 기본적으로 비활성화
4066
4183
  top 8
4067
4184
  left 1
4068
4185
  text 'URL'
4069
4186
  }
4070
- @data['포스트설정']['내용을자동생성'] = checkbox('내용을 키워드 기반으로 자동 생성해서 포스팅'){
4187
+ @data['포스트설정']['내용을자동생성'] = checkbox('키워드기반 생성으로만 등록(GPT 사용시 자체 생성)'){
4071
4188
  top 9
4072
4189
  left 0
4073
4190
  on_toggled{
4074
4191
  if @data['포스트설정']['내용을자동생성'].checked?
4075
- if @data['포스트설정']['내용과자동생성'].checked?
4076
- @data['포스트설정']['내용과자동생성'].checked = false
4077
- end
4192
+ @data['포스트설정']['내용과자동생성'].checked = false
4193
+ @data['포스트설정']['내용투명'].checked = false
4194
+ @data['포스트설정']['자동글 수식에 입력'].checked = false
4195
+
4078
4196
  end
4079
4197
  }
4080
4198
  }
4081
4199
 
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
4200
 
4098
- @data['포스트설정']['gpt하단'] = checkbox('원고내용 아래에 넣기'){
4099
- top 11
4100
- left 3
4101
- }
4201
+
4102
4202
 
4103
4203
  aa1 = 2
4104
- @data['포스트설정']['내용과자동생성'] = checkbox('내용을 내용 파일 + 자동 생성 조합으로 포스팅'){
4204
+ @data['포스트설정']['내용과자동생성'] = checkbox('내용파일+키워드기반 생성 등록(GPT 사용시 자체 생성)') {
4105
4205
  top 10 + aa1
4106
4206
  left 0
4107
- on_toggled{
4108
- if @data['포스트설정']['내용과자동생성'].checked?
4109
- if @data['포스트설정']['내용을자동생성'].checked?
4110
- @data['포스트설정']['내용을자동생성'].checked = false
4111
- end
4112
- end
4207
+ on_toggled {
4208
+ if @data['포스트설정']['내용과자동생성'].checked?
4209
+ @data['포스트설정']['내용을자동생성'].checked = false
4210
+ @data['포스트설정']['내용투명'].enabled = true # '내용투명' 활성화
4211
+ @data['포스트설정']['자동글 수식에 입력'].enabled = true # '내용투명' 활성화
4212
+ else
4213
+ @data['포스트설정']['내용투명'].checked = false # 체크 해제
4214
+ @data['포스트설정']['내용투명'].enabled = false # 비활성화
4215
+ @data['포스트설정']['자동글 수식에 입력'].checked = false # 체크 해제
4216
+ @data['포스트설정']['자동글 수식에 입력'].enabled = false # 비활성화
4217
+ end
4113
4218
  }
4114
- }
4115
- @data['포스트설정']['내용투명'] = checkbox('키워드 기반 자동 생성글 안보이게 처리'){
4116
- top 11+ aa1
4219
+ }
4220
+
4221
+ @data['포스트설정']['내용투명'] = checkbox('키워드 기반 자동 생성글 안보이게 처리') {
4222
+ top 11 + aa1
4117
4223
  left 0
4118
- }
4224
+ enabled false # 기본적으로 비활성화
4225
+ on_toggled {
4226
+ if @data['포스트설정']['내용투명'].checked?
4227
+ @data['포스트설정']['내용을자동생성'].checked = false
4228
+ @data['포스트설정']['자동글 수식에 입력'].checked = false
4229
+ end
4230
+ }
4231
+ }
4119
4232
  @data['포스트설정']['내용자동변경'] = checkbox('내용에 단어들을 자동 변경'){
4120
4233
  top 12+ aa1
4121
4234
  left 0
@@ -4143,6 +4256,18 @@ class Wordpress
4143
4256
  @data['포스트설정']['내용사진자동삽입'] = checkbox('내용 사진 자동 삽입'){
4144
4257
  top 13+ aa1
4145
4258
  left 0
4259
+ #enabled false # 기본적으로 비활성화
4260
+ on_toggled {
4261
+ if @data['포스트설정']['내용사진자동삽입'].checked?
4262
+ @data['포스트설정']['내용사진링크'].enabled = true # '내용투명' 활성화
4263
+ @data['포스트설정']['내용사진링크값'].enabled = true # '내용투명' 활성화
4264
+ else
4265
+ @data['포스트설정']['내용사진링크'].checked = false # 체크 해제
4266
+ @data['포스트설정']['내용사진링크'].enabled = false # 비활성화
4267
+ @data['포스트설정']['내용사진링크값'].text = 'URL' # 기본 텍스트 설정
4268
+ @data['포스트설정']['내용사진링크값'].enabled = false # 비활성화
4269
+ end
4270
+ }
4146
4271
  }
4147
4272
  @data['포스트설정']['내용사진자동삽입시작숫자'] = entry(){
4148
4273
  top 13+ aa1
@@ -4160,15 +4285,28 @@ class Wordpress
4160
4285
  }
4161
4286
 
4162
4287
  @data['포스트설정']['내용사진링크'] = checkbox('내용 사진 자동 삽입시 링크 삽입'){
4288
+ enabled false # 기본적으로 비활성화
4163
4289
  top 14+ aa1
4164
4290
  left 0
4165
4291
  }
4166
4292
 
4167
4293
  @data['포스트설정']['내용사진링크값'] = entry(){
4294
+ enabled false # 기본적으로 비활성화
4168
4295
  top 14+ aa1
4169
4296
  left 1
4170
4297
  text 'URL'
4171
4298
  }
4299
+
4300
+ @data['포스트설정']['ChatGPT사용'] = checkbox('Chat GPT 사용하기'){
4301
+ top 15+ aa1
4302
+ left 0
4303
+ }
4304
+
4305
+ @data['포스트설정']['api_key'] = entry(){
4306
+ top 15+ aa1
4307
+ left 1
4308
+ text 'api key 입력 필수!!'
4309
+ }
4172
4310
  }
4173
4311
  }
4174
4312
 
@@ -4359,6 +4497,22 @@ class Wordpress
4359
4497
  @data['포스트설정']['막글삽입'] = checkbox('내용 하단에 막글 삽입'){
4360
4498
  top 6
4361
4499
  left 0
4500
+ #enabled false # 기본적으로 비활성화
4501
+ on_toggled {
4502
+ if @data['포스트설정']['막글삽입'].checked?
4503
+ @data['포스트설정']['막글투명'].enabled = true # '내용투명' 활성화
4504
+ @data['포스트설정']['막글그대로'].enabled = true # '내용투명' 활성화
4505
+ @data['포스트설정']['막글 수식에 입력'].enabled = true # '내용투명' 활성화
4506
+
4507
+ else
4508
+ @data['포스트설정']['막글투명'].checked = false # 체크 해제
4509
+ @data['포스트설정']['막글투명'].enabled = false # 비활성화
4510
+ @data['포스트설정']['막글그대로'].checked = false # 체크 해제
4511
+ @data['포스트설정']['막글그대로'].enabled = false # 비활성화
4512
+ @data['포스트설정']['막글 수식에 입력'].checked = false # 체크 해제
4513
+ @data['포스트설정']['막글 수식에 입력'].enabled = false # 비활성화
4514
+ end
4515
+ }
4362
4516
  }
4363
4517
  @data['포스트설정']['막글삽입시작숫자'] = entry{
4364
4518
  top 6
@@ -4388,10 +4542,12 @@ class Wordpress
4388
4542
  @data['포스트설정']['막글투명'] = checkbox('막글 안보이게 처리'){
4389
4543
  top 7
4390
4544
  left 0
4545
+ enabled false # 기본적으로 비활성화
4391
4546
  }
4392
4547
  @data['포스트설정']['막글그대로'] = checkbox('막글 그대로 입력'){
4393
4548
  top 7
4394
4549
  left 1
4550
+ enabled false # 기본적으로 비활성화
4395
4551
  }
4396
4552
 
4397
4553
  @data['포스트설정']['태그삽입1'] = checkbox('태그삽입'){
@@ -4416,11 +4572,19 @@ class Wordpress
4416
4572
  @data['포스트설정']['자동글 수식에 입력'] = checkbox('자동글 수식에 입력'){
4417
4573
  top 9
4418
4574
  left 0
4575
+ enabled false # 기본적으로 비활성화
4576
+ on_toggled {
4577
+ if @data['포스트설정']['자동글 수식에 입력'].checked?
4578
+ @data['포스트설정']['내용을자동생성'].checked = false
4579
+ @data['포스트설정']['내용투명'].checked = false
4580
+ end
4581
+ }
4419
4582
  }
4420
4583
 
4421
4584
  @data['포스트설정']['막글 수식에 입력'] = checkbox('막글 수식에 입력'){
4422
4585
  top 9
4423
4586
  left 1
4587
+ enabled false # 기본적으로 비활성화
4424
4588
  }
4425
4589
 
4426
4590
 
@@ -4503,10 +4667,22 @@ class Wordpress
4503
4667
  @data['포스트설정']['테더링'] = checkbox('테더링 IP 사용'){
4504
4668
  top 15
4505
4669
  left 0
4670
+ on_toggled{
4671
+ if @data['포스트설정']['테더링'].checked?
4672
+ @data['포스트설정']['프록시'].checked = false
4673
+
4674
+ end
4675
+ }
4506
4676
  }
4507
4677
  @data['포스트설정']['프록시'] = checkbox('프록시 IP 사용'){
4508
4678
  top 15
4509
4679
  left 1
4680
+ on_toggled{
4681
+ if @data['포스트설정']['프록시'].checked?
4682
+ @data['포스트설정']['테더링'].checked = false
4683
+
4684
+ end
4685
+ }
4510
4686
  }
4511
4687
  button('프록시 IP 파일 불러오기'){
4512
4688
  top 15