cafe_buy 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_buy.rb +527 -376
  3. metadata +2 -2
data/lib/cafe_buy.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
@@ -942,52 +996,10 @@ end
942
996
  noko = Nokogiri::HTML(content, nil, Encoding::UTF_8.to_s)
943
997
  toomung = 0
944
998
  h = Hash.new
945
- # h[:authority] = 'blog.naver.com'
946
- # h[:method] = 'POST'
947
- # h[:path] = '/RabbitWrite.naver'
948
- # h[:scheme] = 'https'
949
- # h['accept'] = 'application/json, text/plain, */*'
950
- # h['accept-encoding'] = 'gzip, deflate, br'
951
- # h['accept-language'] = 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7'
952
- # h['content-type'] = 'application/x-www-form-urlencoded'
953
- # h['cookie'] = @cookie
954
- # h['origin'] = 'https://blog.naver.com'
955
- # h['referer'] = 'https://blog.naver.com/'+@user_id+'/postwrite?categoryNo=1'
956
- # h['sec-ch-ua'] = '"Chromium";v="106", "Google Chrome";v="106", "Not;A=Brand";v="99"'
957
- # h['sec-ch-ua-mobile'] = '?0'
958
- # h['sec-ch-ua-platform'] = '"Windows"'
959
- # h['sec-fetch-dest'] = 'empty'
960
- # h['sec-fetch-mode'] = 'cors'
961
- # h['sec-fetch-site'] = 'same-origin'
962
- # 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'
999
+
963
1000
 
964
1001
  data = Hash.new
965
- # data['blogId'] = @user_id
966
- # data['documentModel'] = Hash.new
967
- # data['documentModel']['documentId'] = ''
968
- # data['documentModel']['document'] = Hash.new
969
- # data['documentModel']['document']['version'] = '2.6.0'
970
- # data['documentModel']['document']['theme'] = 'default'
971
- # data['documentModel']['document']['language'] = 'ko-KR'
972
- # data['documentModel']['document']['components'] = Array.new
973
- # data['documentModel']['document']['components'][0] = {
974
- # 'id' => create_id(),
975
- # 'layout' => 'default',
976
- # 'title' => [
977
- # {
978
- # 'id' => create_id(),
979
- # 'nodes' => [{
980
- # 'id' => create_id(),
981
- # 'value' => title,
982
- # '@ctype' => 'textNode'
983
- # }],
984
- # '@ctype' => 'paragraph'
985
- # }
986
- # ],
987
- # 'subTitle' => nil,
988
- # 'align' => 'left',
989
- # '@ctype' => 'documentTitle'
990
- # }
1002
+
991
1003
 
992
1004
  check_position = 1
993
1005
  noko.css('p').each do |i|
@@ -1037,21 +1049,7 @@ end
1037
1049
  sleep(3)
1038
1050
  key_stroke('enter')
1039
1051
  sleep(3)
1040
- # @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
1041
- # puts path = CGI.unescape(path)
1042
- # image_data = image_update(path)
1043
- # components_value = Hash.new
1044
- # components_value['id'] = create_id()
1045
- # components_value['layout'] = 'default'
1046
- # begin
1047
- # if i.to_s.split('text-align: ')[1].split(';')[0] == 'center'
1048
- # components_value['align'] = 'center'
1049
- # elsif i.to_s.split('text-align: ')[1].split(';')[0] == 'right'
1050
- # components_value['align'] = 'right'
1051
- # else
1052
-
1053
- # end
1054
- # rescue
1052
+
1055
1053
 
1056
1054
  if i2.to_s.split('href="')[1] != nil
1057
1055
  href2 = i2.to_s.split('href="')[1].split('"')[0]
@@ -1067,30 +1065,7 @@ end
1067
1065
  #key_stroke('enter')
1068
1066
  sleep(1)
1069
1067
  end
1070
- # end
1071
- # components_value['src'] = 'https://blogfiles.pstatic.net'+image_data['item']['url']+'?type=w1'
1072
- # components_value['internalResource'] = true
1073
- # components_value['represent'] = true
1074
- # components_value['path'] = image_data['item']['url']
1075
- # components_value['domain'] = "https://blogfiles.pstatic.net"
1076
- # components_value['fileSize'] = image_data['item']['fileSize'].to_i
1077
- # components_value['width'] = image_data['item']['width'].to_i
1078
- # components_value['widthPercentage'] = 0
1079
- # components_value['height'] = image_data['item']['height'].to_i
1080
- # components_value['fileName'] = image_data['item']['fileName'].to_i
1081
- # components_value['caption'] = nil
1082
- # if i2.to_s.split('href="')[1] != nil
1083
- # components_value['link'] = CGI.unescape(i2.to_s.split('href="')[1].split('"')[0])
1084
- # end
1085
- # components_value['format'] = 'normal'
1086
- # components_value['displayFormat'] = 'normal'
1087
- # components_value['imageLoaded'] = true
1088
- # components_value['contentMode'] = 'fit'
1089
- # components_value['origin'] = {
1090
- # 'srcFrom' => 'local',
1091
- # '@ctype' => 'imageOrigin'
1092
- # }
1093
- # components_value['@ctype'] = 'image'
1068
+
1094
1069
  elsif i2.to_s.include?('<video')
1095
1070
  path = i2.to_s.split('src="')[1].split('"')[0]
1096
1071
  path = URI.decode_www_form(path)[0][0]
@@ -1129,10 +1104,9 @@ end
1129
1104
  @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]').click
1130
1105
  @driver.action.send_keys(title).perform
1131
1106
  sleep(1)
1132
-
1133
1107
  @driver.action.key_down(:enter).key_up(:enter).perform #엔터
1134
-
1135
-
1108
+ sleep(1)
1109
+
1136
1110
  elsif i2.to_s.include?('<inyonggoo')
1137
1111
  if i2.text == ''
1138
1112
 
@@ -1953,107 +1927,19 @@ class Wordpress
1953
1927
 
1954
1928
 
1955
1929
 
1956
- def chrome_start(url, user_id, user_pw)
1957
- @url = url
1958
- @user_id = user_id
1959
- @user_pw = user_pw
1960
- begin
1961
- Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
1962
- @driver = Selenium::WebDriver.for :chrome
1963
- rescue
1964
- @driver = Selenium::WebDriver.for :chrome
1965
- end
1966
- end
1930
+ #def chrome_start(url, user_id, user_pw)
1931
+ # @url = url
1932
+ # @user_id = user_id
1933
+ # @user_pw = user_pw
1934
+ # begin
1935
+ # Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
1936
+ # @driver = Selenium::WebDriver.for :chrome
1937
+ # rescue
1938
+ # @driver = Selenium::WebDriver.for :chrome
1939
+ # end
1940
+ #end
1967
1941
 
1968
- def login
1969
- @driver.get(@url+'/wp-admin')
1970
- @driver.find_element(:xpath , '//*[@id="user_login"]').send_keys(@user_id)
1971
- @driver.find_element(:xpath , '//*[@id="user_pass"]').send_keys(@user_pw)
1972
- @driver.find_element(:xpath , '//*[@id="wp-submit"]').click
1973
- @cookie = Hash.new
1974
- @driver.manage.all_cookies.each do |i|
1975
- @cookie[i[:name]] = i[:value]
1976
- end
1977
- sleep(2)
1978
- begin
1979
- puts @driver.find_element(:xpath , '/html/body/div/div/div[1]/div[1]/div/div[1]/a[1]/span').text
1980
- @driver.close
1981
- return 1
1982
- rescue => e
1983
- puts e
1984
- @driver.close
1985
- return 0
1986
- end
1987
- end
1988
1942
 
1989
- def update
1990
- http = HTTP.cookies(@cookie).get(@url+'/wp-admin/post-new.php')
1991
- noko = Nokogiri::HTML(http.to_s)
1992
- @wpnonce = http.to_s.split('_wpnonce":"')[1].split('"')[0]
1993
- @data2 = Hash.new
1994
- @data2['_wpnonce'] = noko.xpath('//*[@id="_wpnonce"]')[0]['value']
1995
- @data2['_wp_http_referer'] = '/wp-admin/post-new.php'
1996
- @data2['user_ID'] = '1'
1997
- @data2['action'] = 'editpost'
1998
- @data2['originalaction'] = 'editpost'
1999
- @data2['post_author'] = '1'
2000
- @data2['post_type'] = 'post'
2001
- @data2['original_post_status'] = 'auto-draft'
2002
- @data2['referredby'] = @url+'/wp-admin/update-core.php'
2003
- @data2['_wp_original_http_referer'] = @url+'/wp-admin/update-core.php'
2004
- @data2['auto_draft'] = nil
2005
- @data2['post_ID'] = noko.xpath('//*[@id="post_ID"]')[0]['value']
2006
- @data2['meta-box-order-nonce'] = noko.xpath('//*[@id="meta-box-order-nonce"]')[0]['value']
2007
- @data2['closedpostboxesnonce'] = noko.xpath('//*[@id="closedpostboxesnonce"]')[0]['value']
2008
- @data2['post_title'] = 'title3'
2009
- @data2['samplepermalinknonce'] = noko.xpath('//*[@id="samplepermalinknonce"]')[0]['value']
2010
- @data2['content'] = 'content3'
2011
- @data2['wp-preview'] = nil
2012
- @data2['hidden_post_status'] = 'draft'
2013
- @data2['post_status'] = 'draft'
2014
- @data2['hidden_post_password'] = nil
2015
- @data2['hidden_post_visibility'] = 'public'
2016
- @data2['visibility'] = 'post'
2017
- @data2['post_password'] = nil
2018
- @data2['mm'] = '10'
2019
- @data2['jj'] = '24'
2020
- @data2['aa'] = '2022'
2021
- @data2['hh'] = '02'
2022
- @data2['mn'] = '41'
2023
- @data2['ss'] = '32'
2024
- @data2['hidden_mm'] = '10'
2025
- @data2['cur_mm'] = '10'
2026
- @data2['hidden_jj'] = '24'
2027
- @data2['cur_jj'] = '24'
2028
- @data2['hidden_aa'] = '2022'
2029
- @data2['cur_aa'] = '2022'
2030
- @data2['hidden_hh'] = '02'
2031
- @data2['cur_hh'] = '02'
2032
- @data2['hidden_mn'] = '41'
2033
- @data2['cur_mn'] = '41'
2034
- @data2['original_publish'] = '공개'
2035
- @data2['publish'] = '공개'
2036
- @data2['post_format'] = '0'
2037
- @data2['post_category[]'] = '0'
2038
- @data2['newcategory'] = '새 카테고리 이름'
2039
- @data2['newcategory_parent'] = -1
2040
- @data2['_ajax_nonce-add-category'] = noko.xpath('//*[@id="_ajax_nonce-add-category"]')[0]['value']
2041
- @data2['tax_input[post_tag]'] = nil
2042
- @data2['newtag[post_tag]'] = nil
2043
- @data2['_thumbnail_id'] = -1
2044
- @data2['excerpt'] = nil
2045
- @data2['trackback_url'] = nil
2046
- @data2['metakeyinput'] = nil
2047
- @data2['metavalue'] = nil
2048
- @data2['_ajax_nonce-add-meta'] = noko.xpath('//*[@id="_ajax_nonce-add-meta"]')[0]['value']
2049
- @data2['advanced_view'] = '1'
2050
- @data2['comment_status'] = 'open'
2051
- @data2['ping_status'] = 'open'
2052
- @data2['post_name'] = nil
2053
- @data2['post_author_override'] = '1'
2054
- #result_http = HTTP.cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data)
2055
- return @data2
2056
- end
2057
1943
 
2058
1944
  def auto_image
2059
1945
  begin
@@ -2396,6 +2282,13 @@ class Wordpress
2396
2282
  end
2397
2283
  end
2398
2284
  end
2285
+
2286
+ if @data['포스트설정']['gpt제목'].checked?
2287
+ chat = Chat_title.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'))
2288
+ gpt_text1 = chat.message(title)
2289
+ title = gpt_text1.to_s
2290
+ end
2291
+
2399
2292
  @data['table'][index][-1] = 5
2400
2293
  @data['table'] << []
2401
2294
  @data['table'].pop
@@ -2433,6 +2326,25 @@ class Wordpress
2433
2326
  end
2434
2327
  end
2435
2328
  end
2329
+
2330
+
2331
+ if @data['포스트설정']['gpt내용'].checked?
2332
+ api_key = @data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8')
2333
+ #key_change = @data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8')
2334
+ #imotcon_change = @data['포스트설정']['스티커로변경단어'].text.to_s.force_encoding('utf-8')
2335
+ #template_change = @data['포스트설정']['내템플릿변경단어'].text.to_s.force_encoding('utf-8')
2336
+ #ttdanar_change = @data['포스트설정']['단어링크적용단어'].text.to_s.force_encoding('utf-8')
2337
+ #sajine_change = @data['포스트설정']['단어사진으로변경단어'].text.to_s.force_encoding('utf-8')
2338
+ #mov_change = @data['포스트설정']['영상으로변경단어'].text.to_s.force_encoding('utf-8')
2339
+ #map_change = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8')
2340
+ #inyong9_change = @data['포스트설정']['인용구변경단어'].text.to_s.force_encoding('utf-8')
2341
+
2342
+
2343
+ chat = Chat_content.new(api_key)
2344
+ gpt_text3 = chat.message(content)
2345
+ content = gpt_text3.to_s
2346
+ end
2347
+
2436
2348
  content_tag = content.split('@##@')[1]
2437
2349
  content = content.split('@##@')[0]
2438
2350
  @data['table'][index][-1] = 15
@@ -2631,7 +2543,7 @@ class Wordpress
2631
2543
  @data['table'][index][-1] = 50
2632
2544
  @data['table'] << []
2633
2545
  @data['table'].pop
2634
- if @data['포스트설정']['gpt'].checked?
2546
+ if @data['포스트설정']['gpt키워드'].checked?
2635
2547
  chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'))
2636
2548
  gpt_text = chat.message(keyword)
2637
2549
  content = content + "\n(자동생성글)\n" + gpt_text
@@ -2652,7 +2564,7 @@ class Wordpress
2652
2564
  joongbok_check = 0
2653
2565
  counter10 = 0
2654
2566
  while joongbok_check == 0
2655
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2567
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2656
2568
  content22 = content.split("(자동생성글)")[1].split("\n")
2657
2569
  else
2658
2570
  content22 = content.split("\n")
@@ -2676,12 +2588,12 @@ class Wordpress
2676
2588
  content2 = content.split("\n")
2677
2589
  end
2678
2590
 
2679
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2591
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2680
2592
  content2 = content.split("(자동생성글)")[1].split("\n")
2681
2593
  position.pop
2682
2594
  end
2683
2595
 
2684
- if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt'].checked? == false
2596
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt키워드'].checked? == false
2685
2597
  content2 = content.split("\n")
2686
2598
  end
2687
2599
 
@@ -2727,7 +2639,7 @@ class Wordpress
2727
2639
  content = content3.join("\n")
2728
2640
  end
2729
2641
 
2730
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2642
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2731
2643
  content2.each_with_index do |con, index|
2732
2644
  if position.include?(index)
2733
2645
  insert_keyword_text = keyword.to_s
@@ -2757,7 +2669,7 @@ class Wordpress
2757
2669
  end
2758
2670
  end
2759
2671
 
2760
- if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt'].checked? == false
2672
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt키워드'].checked? == false
2761
2673
  begin
2762
2674
  content2.each_with_index do |con, index|
2763
2675
  if position.include?(index)
@@ -2852,7 +2764,7 @@ class Wordpress
2852
2764
  end
2853
2765
  end
2854
2766
 
2855
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2767
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2856
2768
  if @data['포스트설정']['자동글 수식에 입력'].checked?
2857
2769
  content5 = content.split("(자동생성글)")[0].to_s.split("\n")
2858
2770
  content55 = content.split("(자동생성글)")[1].to_s
@@ -2882,9 +2794,9 @@ class Wordpress
2882
2794
  end
2883
2795
  end
2884
2796
 
2885
- position = position.sort
2797
+ position = position.sort
2886
2798
  ##여기서부터 이미지 순서대로 안되서 변경####-------------------------------------------------------------------------------
2887
- # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2799
+ # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2888
2800
  # image_url22 = get_image_file().force_encoding('utf-8')
2889
2801
  # end
2890
2802
 
@@ -2902,7 +2814,7 @@ class Wordpress
2902
2814
  # end
2903
2815
  # end
2904
2816
 
2905
- # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2817
+ # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2906
2818
  # content = content5.join("\n")+'(자동생성글)'+content55
2907
2819
  # iconv = Iconv.new('UTF-8', 'ASCII-8BIT')
2908
2820
  # content = iconv.iconv(content)
@@ -2922,7 +2834,7 @@ class Wordpress
2922
2834
  ###여기까지 이미지 순서대로 안되서 변경##-------------------------------------------------------------------------------
2923
2835
 
2924
2836
  ##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
2925
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2837
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2926
2838
  sleep(2)
2927
2839
  puts '이미지 자동 세탁 중 · · · '
2928
2840
  end
@@ -2941,7 +2853,7 @@ class Wordpress
2941
2853
  end
2942
2854
  sleep(2)
2943
2855
  puts '이미지 자동 세탁 완료 · · · '
2944
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2856
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2945
2857
  content = content5.join("\n")+'(자동생성글)'+content55
2946
2858
  puts content
2947
2859
  ##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
@@ -3081,7 +2993,7 @@ class Wordpress
3081
2993
  content = content
3082
2994
  soosick_1 = content_end
3083
2995
  else
3084
- if @data['포스트설정']['gpt'].checked?
2996
+ if @data['포스트설정']['gpt키워드'].checked?
3085
2997
  if @data['포스트설정']['gpt상단'].checked?
3086
2998
  content = content_end+"\n"+content+"\n"
3087
2999
  else
@@ -3750,7 +3662,10 @@ class Wordpress
3750
3662
  }
3751
3663
  horizontal_box{
3752
3664
  stretchy false
3665
+ grid{
3753
3666
  button('전체선택'){
3667
+ top 1
3668
+ left 1
3754
3669
  on_clicked{
3755
3670
  for n in 0..@data['키워드설정']['키워드'].length-1
3756
3671
  @data['키워드설정']['키워드'][n][0] = true
@@ -3759,7 +3674,20 @@ class Wordpress
3759
3674
  end
3760
3675
  }
3761
3676
  }
3762
- button('키워드삭제'){
3677
+ button('선택해제'){
3678
+ top 1
3679
+ left 2
3680
+ on_clicked{
3681
+ for n in 0..@data['키워드설정']['키워드'].length-1
3682
+ @data['키워드설정']['키워드'][n][0] = false
3683
+ @data['키워드설정']['키워드'] << []
3684
+ @data['키워드설정']['키워드'].pop
3685
+ end
3686
+ }
3687
+ }
3688
+ button('삭제하기'){
3689
+ top 1
3690
+ left 3
3763
3691
  on_clicked{
3764
3692
  m = Array.new
3765
3693
  for n in 0..@data['키워드설정']['키워드'].length-1
@@ -3774,6 +3702,8 @@ class Wordpress
3774
3702
  @data['키워드설정']['키워드'].delete(nil)
3775
3703
  }
3776
3704
  }
3705
+ }
3706
+
3777
3707
  @data['키워드설정']['순서사용'] = checkbox('순서사용'){
3778
3708
  stretchy false
3779
3709
  on_toggled{ |c|
@@ -3791,6 +3721,59 @@ class Wordpress
3791
3721
  }
3792
3722
  }
3793
3723
  }
3724
+ vertical_separator{
3725
+ stretchy false
3726
+ }
3727
+ horizontal_box{
3728
+ stretchy false
3729
+ grid{
3730
+ @data['포스트설정']['gpt키워드'] = checkbox('GPT 키워드 기반 글 생성'){
3731
+ top 1
3732
+ left 0
3733
+ #enabled false # 기본적으로 비활성화
3734
+ on_toggled {
3735
+ if @data['포스트설정']['gpt키워드'].checked?
3736
+ @data['포스트설정']['gpt상단'].enabled = true # '내용투명' 활성화
3737
+ @data['포스트설정']['gpt하단'].enabled = true # '내용투명' 활성화
3738
+ else
3739
+ @data['포스트설정']['gpt상단'].checked = false # 체크 해제
3740
+ @data['포스트설정']['gpt상단'].enabled = false # 비활성화
3741
+ @data['포스트설정']['gpt하단'].checked = false # 체크 해제
3742
+ @data['포스트설정']['gpt하단'].enabled = false # 비활성화
3743
+ end
3744
+ }
3745
+
3746
+ }
3747
+
3748
+ @data['포스트설정']['gpt상단'] = checkbox('원고 위에 넣기'){
3749
+ top 1
3750
+ left 1
3751
+ enabled false # 기본적으로 비활성화
3752
+ on_toggled{
3753
+ if @data['포스트설정']['gpt상단'].checked?
3754
+ @data['포스트설정']['gpt하단'].checked = false
3755
+ end
3756
+ }
3757
+ }
3758
+
3759
+ @data['포스트설정']['gpt하단'] = checkbox('원고 아래 넣기'){
3760
+ top 1
3761
+ left 2
3762
+ enabled false # 기본적으로 비활성화
3763
+ on_toggled{
3764
+ if @data['포스트설정']['gpt하단'].checked?
3765
+ @data['포스트설정']['gpt상단'].checked = false
3766
+ end
3767
+ }
3768
+ }
3769
+ } }
3770
+ horizontal_box{
3771
+ stretchy false
3772
+ grid{
3773
+ label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
3774
+ } } }
3775
+
3776
+
3794
3777
  table{
3795
3778
  checkbox_column('선택'){
3796
3779
  editable true
@@ -3801,7 +3784,9 @@ class Wordpress
3801
3784
 
3802
3785
  cell_rows @data['키워드설정']['키워드']
3803
3786
  }
3804
-
3787
+
3788
+
3789
+
3805
3790
  }
3806
3791
  vertical_separator{
3807
3792
  stretchy false
@@ -3830,7 +3815,10 @@ class Wordpress
3830
3815
  }
3831
3816
  horizontal_box{
3832
3817
  stretchy false
3818
+ grid{
3833
3819
  button('전체선택'){
3820
+ top 1
3821
+ left 1
3834
3822
  on_clicked{
3835
3823
  for n in 0..@data['제목설정']['제목'].length-1
3836
3824
  @data['제목설정']['제목'][n][0] = true
@@ -3839,7 +3827,20 @@ class Wordpress
3839
3827
  end
3840
3828
  }
3841
3829
  }
3842
- button('제목삭제'){
3830
+ button('선택해제'){
3831
+ top 1
3832
+ left 2
3833
+ on_clicked{
3834
+ for n in 0..@data['제목설정']['제목'].length-1
3835
+ @data['제목설정']['제목'][n][0] = false
3836
+ @data['제목설정']['제목'] << []
3837
+ @data['제목설정']['제목'].pop
3838
+ end
3839
+ }
3840
+ }
3841
+ button('삭제하기'){
3842
+ top 1
3843
+ left 3
3843
3844
  on_clicked{
3844
3845
  m = Array.new
3845
3846
  for n in 0..@data['제목설정']['제목'].length-1
@@ -3854,6 +3855,7 @@ class Wordpress
3854
3855
  @data['제목설정']['제목'].delete(nil)
3855
3856
  }
3856
3857
  }
3858
+ }
3857
3859
  @data['제목설정']['순서사용'] = checkbox('순서사용'){
3858
3860
  stretchy false
3859
3861
  on_toggled{ |c|
@@ -3871,6 +3873,23 @@ class Wordpress
3871
3873
  }
3872
3874
  }
3873
3875
  }
3876
+ vertical_separator{
3877
+ stretchy false
3878
+ }
3879
+ horizontal_box{
3880
+ stretchy false
3881
+ grid{
3882
+ @data['포스트설정']['gpt제목'] = checkbox('제목을 이용해 GPT로 비슷한 제목 생성'){
3883
+
3884
+
3885
+ }}}
3886
+ horizontal_box{
3887
+ stretchy false
3888
+ grid{
3889
+ label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
3890
+ } } }
3891
+
3892
+
3874
3893
  table{
3875
3894
  checkbox_column('선택'){
3876
3895
  editable true
@@ -3881,6 +3900,7 @@ class Wordpress
3881
3900
 
3882
3901
  cell_rows @data['제목설정']['제목']
3883
3902
  }
3903
+
3884
3904
 
3885
3905
  }
3886
3906
  vertical_separator{
@@ -3908,7 +3928,10 @@ class Wordpress
3908
3928
  }
3909
3929
  horizontal_box{
3910
3930
  stretchy false
3931
+ grid{
3911
3932
  button('전체선택'){
3933
+ top 1
3934
+ left 1
3912
3935
  on_clicked{
3913
3936
  for n in 0..@data['내용설정']['내용'].length-1
3914
3937
  @data['내용설정']['내용'][n][0] = true
@@ -3917,7 +3940,20 @@ class Wordpress
3917
3940
  end
3918
3941
  }
3919
3942
  }
3920
- button('내용삭제'){
3943
+ button('선택해제'){
3944
+ top 1
3945
+ left 2
3946
+ on_clicked{
3947
+ for n in 0..@data['내용설정']['내용'].length-1
3948
+ @data['내용설정']['내용'][n][0] = false
3949
+ @data['내용설정']['내용'] << []
3950
+ @data['내용설정']['내용'].pop
3951
+ end
3952
+ }
3953
+ }
3954
+ button('삭제하기'){
3955
+ top 1
3956
+ left 3
3921
3957
  on_clicked{
3922
3958
  m = Array.new
3923
3959
  for n in 0..@data['내용설정']['내용'].length-1
@@ -3932,6 +3968,7 @@ class Wordpress
3932
3968
  @data['내용설정']['내용'].delete(nil)
3933
3969
  }
3934
3970
  }
3971
+ }
3935
3972
  @data['내용설정']['순서사용'] = checkbox('순서사용'){
3936
3973
  stretchy false
3937
3974
  on_toggled{ |c|
@@ -3949,6 +3986,22 @@ class Wordpress
3949
3986
  }
3950
3987
  }
3951
3988
  }
3989
+ vertical_separator{
3990
+ stretchy false
3991
+ }
3992
+ horizontal_box{
3993
+ stretchy false
3994
+ grid{
3995
+ @data['포스트설정']['gpt내용'] = checkbox('내용파일을 이용해 GPT로 글 변형'){
3996
+
3997
+
3998
+ }}}
3999
+ horizontal_box{
4000
+ stretchy false
4001
+ grid{
4002
+ label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
4003
+ } } }
4004
+
3952
4005
  table{
3953
4006
  checkbox_column('선택'){
3954
4007
  editable true
@@ -3966,8 +4019,8 @@ class Wordpress
3966
4019
  stretchy false
3967
4020
  text "내용폴더경로 ex)C:\\내용\\폴더1"
3968
4021
  }
3969
- button('폴더째로불러오기'){
3970
- stretchy false
4022
+ button('폴더째로 불러오기'){
4023
+
3971
4024
  on_clicked{
3972
4025
  path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3973
4026
  Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
@@ -4065,7 +4118,7 @@ class Wordpress
4065
4118
  text "사진폴더경로 ex)C:\\사진\\폴더2"
4066
4119
  }
4067
4120
  button('폴더째로불러오기'){
4068
- stretchy false
4121
+
4069
4122
  on_clicked{
4070
4123
  path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
4071
4124
  Dir.entries(@data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')).each do |file|
@@ -4318,6 +4371,18 @@ class Wordpress
4318
4371
  @data['포스트설정']['제목에키워드삽입'] = checkbox('제목에 키워드 삽입'){
4319
4372
  top 2
4320
4373
  left 0
4374
+ #enabled false # 기본적으로 비활성화
4375
+ on_toggled {
4376
+ if @data['포스트설정']['제목에키워드삽입'].checked?
4377
+ @data['포스트설정']['제목앞'].enabled = true # '내용투명' 활성화
4378
+ @data['포스트설정']['제목뒤'].enabled = true # '내용투명' 활성화
4379
+ else
4380
+ @data['포스트설정']['제목앞'].checked = false # 체크 해제
4381
+ @data['포스트설정']['제목앞'].enabled = false # 비활성화
4382
+ @data['포스트설정']['제목뒤'].checked = false # 체크 해제
4383
+ @data['포스트설정']['제목뒤'].enabled = false # 비활성화
4384
+ end
4385
+ }
4321
4386
  }
4322
4387
  @data['포스트설정']['제목에키워드삽입숫자1'] = entry(){
4323
4388
  top 2
@@ -4340,6 +4405,7 @@ class Wordpress
4340
4405
  @data['포스트설정']['제목앞'] = checkbox('제목에 키워드 삽입 제목 앞'){
4341
4406
  top 3
4342
4407
  left 3
4408
+ enabled false # 기본적으로 비활성화
4343
4409
  on_toggled{
4344
4410
  if @data['포스트설정']['제목앞'].checked? == true
4345
4411
  if @data['포스트설정']['제목뒤'].checked?
@@ -4355,6 +4421,7 @@ class Wordpress
4355
4421
  @data['포스트설정']['제목뒤'] = checkbox('제목에 키워드 삽입 제목 뒤'){
4356
4422
  top 4
4357
4423
  left 3
4424
+ enabled false # 기본적으로 비활성화
4358
4425
  on_toggled{
4359
4426
  if @data['포스트설정']['제목뒤'].checked? == true
4360
4427
  if @data['포스트설정']['제목앞'].checked?
@@ -4363,26 +4430,51 @@ class Wordpress
4363
4430
  end
4364
4431
  }
4365
4432
  }
4366
- @data['포스트설정']['제목내용설정'] = checkbox('내용의 문장을 제목으로 설정'){
4433
+ @data['포스트설정']['특수문자'] = checkbox('제목에 키워드 삽입 특수문자 삽입'){
4367
4434
  top 4
4368
4435
  left 0
4369
4436
  }
4370
-
4371
- @data['포스트설정']['특수문자'] = checkbox('제목에 키워드 삽입 시 특수문자 삽입'){
4437
+ @data['포스트설정']['제목을랜덤'] = checkbox('제목을 랜덤 단어 조합으로 자동 입력'){
4372
4438
  top 5
4373
4439
  left 0
4440
+ on_toggled{
4441
+ if @data['포스트설정']['제목을랜덤'].checked? == true
4442
+ if @data['포스트설정']['제목내용설정'].checked?
4443
+ @data['포스트설정']['제목내용설정'].checked = false
4444
+ end
4445
+ end
4446
+ }
4374
4447
  }
4375
- @data['포스트설정']['제목을랜덤'] = checkbox('제목을 랜덤 단어 조합으로 자동 입력'){
4448
+ @data['포스트설정']['제목내용설정'] = checkbox('내용의 문장을 제목으로 설정'){
4376
4449
  top 6
4377
4450
  left 0
4451
+ on_toggled{
4452
+ if @data['포스트설정']['제목내용설정'].checked? == true
4453
+ if @data['포스트설정']['제목을랜덤'].checked?
4454
+ @data['포스트설정']['제목을랜덤'].checked = false
4455
+ end
4456
+ end
4457
+ }
4378
4458
  }
4379
4459
  @data['포스트설정']['내용키워드삽입'] = checkbox('내용 키워드 삽입'){
4380
4460
  top 7
4381
4461
  left 0
4462
+ on_toggled {
4463
+ if @data['포스트설정']['내용키워드삽입'].checked?
4464
+ @data['포스트설정']['키워드삽입'].enabled = true # '내용투명' 활성화
4465
+ @data['포스트설정']['키워드삽입시링크'].enabled = true # '내용투명' 활성화
4466
+ else
4467
+ @data['포스트설정']['키워드삽입'].checked = false # 체크 해제
4468
+ @data['포스트설정']['키워드삽입'].enabled = false # 비활성화
4469
+ @data['포스트설정']['키워드삽입시링크'].text = 'URL' # 기본 텍스트 설정
4470
+ @data['포스트설정']['키워드삽입시링크'].enabled = false # 비활성화
4471
+ end
4472
+ }
4382
4473
  }
4383
4474
  @data['포스트설정']['키워드삽입시작숫자'] = entry(){
4384
4475
  top 7
4385
4476
  left 1
4477
+
4386
4478
  text '최소수량'
4387
4479
  }
4388
4480
  label('~'){
@@ -4403,55 +4495,51 @@ class Wordpress
4403
4495
  left 1
4404
4496
  text 'URL'
4405
4497
  }
4406
- @data['포스트설정']['내용을자동생성'] = checkbox('내용을 키워드 기반으로 자동 생성해서 포스팅'){
4498
+ @data['포스트설정']['내용을자동생성'] = checkbox('키워드기반 생성으로만 등록(GPT 사용시 자체 생성)'){
4407
4499
  top 9
4408
4500
  left 0
4409
4501
  on_toggled{
4410
4502
  if @data['포스트설정']['내용을자동생성'].checked?
4411
- if @data['포스트설정']['내용과자동생성'].checked?
4412
- @data['포스트설정']['내용과자동생성'].checked = false
4413
- end
4503
+ @data['포스트설정']['내용과자동생성'].checked = false
4504
+ @data['포스트설정']['내용투명'].checked = false
4505
+ @data['포스트설정']['자동글 수식에 입력'].checked = false
4506
+
4414
4507
  end
4415
4508
  }
4416
4509
  }
4417
4510
 
4418
- @data['포스트설정']['gpt'] = checkbox('내용을 키워드 기반의 GPT로 생성해서 포스팅'){
4419
- top 10
4420
- left 0
4421
- }
4422
-
4423
- @data['포스트설정']['api_key'] = entry(){
4424
- top 10
4425
- left 1
4426
- text 'api key'
4427
- }
4511
+
4428
4512
 
4429
- @data['포스트설정']['gpt상단'] = checkbox('원고내용 위에 넣기'){
4430
- top 10
4431
- left 3
4432
- }
4433
-
4434
- @data['포스트설정']['gpt하단'] = checkbox('원고내용 아래에 넣기'){
4435
- top 11
4436
- left 3
4437
- }
4438
4513
 
4439
4514
  aa1 = 2
4440
- @data['포스트설정']['내용과자동생성'] = checkbox('내용을 내용 파일 + 자동 생성 조합으로 포스팅'){
4515
+ @data['포스트설정']['내용과자동생성'] = checkbox('내용파일+키워드기반 생성 등록(GPT 사용시 자체 생성)') {
4441
4516
  top 10 + aa1
4442
4517
  left 0
4443
- on_toggled{
4444
- if @data['포스트설정']['내용과자동생성'].checked?
4445
- if @data['포스트설정']['내용을자동생성'].checked?
4446
- @data['포스트설정']['내용을자동생성'].checked = false
4447
- end
4448
- end
4518
+ on_toggled {
4519
+ if @data['포스트설정']['내용과자동생성'].checked?
4520
+ @data['포스트설정']['내용을자동생성'].checked = false
4521
+ @data['포스트설정']['내용투명'].enabled = true # '내용투명' 활성화
4522
+ @data['포스트설정']['자동글 수식에 입력'].enabled = true # '내용투명' 활성화
4523
+ else
4524
+ @data['포스트설정']['내용투명'].checked = false # 체크 해제
4525
+ @data['포스트설정']['내용투명'].enabled = false # 비활성화
4526
+ @data['포스트설정']['자동글 수식에 입력'].checked = false # 체크 해제
4527
+ @data['포스트설정']['자동글 수식에 입력'].enabled = false # 비활성화
4528
+ end
4449
4529
  }
4450
- }
4451
- @data['포스트설정']['내용투명'] = checkbox('키워드 기반 자동 생성글 안보이게 처리'){
4452
- top 11+ aa1
4530
+ }
4531
+
4532
+ @data['포스트설정']['내용투명'] = checkbox('키워드 기반 자동 생성글 안보이게 처리') {
4533
+ top 11 + aa1
4453
4534
  left 0
4454
- }
4535
+ enabled false # 기본적으로 비활성화
4536
+ on_toggled {
4537
+ if @data['포스트설정']['내용투명'].checked?
4538
+ @data['포스트설정']['내용을자동생성'].checked = false
4539
+ @data['포스트설정']['자동글 수식에 입력'].checked = false
4540
+ end
4541
+ }
4542
+ }
4455
4543
  @data['포스트설정']['내용자동변경'] = checkbox('내용에 단어들을 자동 변경'){
4456
4544
  top 12+ aa1
4457
4545
  left 0
@@ -4479,6 +4567,18 @@ class Wordpress
4479
4567
  @data['포스트설정']['내용사진자동삽입'] = checkbox('내용 사진 자동 삽입'){
4480
4568
  top 13+ aa1
4481
4569
  left 0
4570
+ #enabled false # 기본적으로 비활성화
4571
+ on_toggled {
4572
+ if @data['포스트설정']['내용사진자동삽입'].checked?
4573
+ @data['포스트설정']['내용사진링크'].enabled = true # '내용투명' 활성화
4574
+ @data['포스트설정']['내용사진링크값'].enabled = true # '내용투명' 활성화
4575
+ else
4576
+ @data['포스트설정']['내용사진링크'].checked = false # 체크 해제
4577
+ @data['포스트설정']['내용사진링크'].enabled = false # 비활성화
4578
+ @data['포스트설정']['내용사진링크값'].text = 'URL' # 기본 텍스트 설정
4579
+ @data['포스트설정']['내용사진링크값'].enabled = false # 비활성화
4580
+ end
4581
+ }
4482
4582
  }
4483
4583
  @data['포스트설정']['내용사진자동삽입시작숫자'] = entry(){
4484
4584
  top 13+ aa1
@@ -4496,15 +4596,28 @@ class Wordpress
4496
4596
  }
4497
4597
 
4498
4598
  @data['포스트설정']['내용사진링크'] = checkbox('내용 사진 자동 삽입시 링크 삽입'){
4599
+ enabled false # 기본적으로 비활성화
4499
4600
  top 14+ aa1
4500
4601
  left 0
4501
4602
  }
4502
4603
 
4503
4604
  @data['포스트설정']['내용사진링크값'] = entry(){
4605
+ enabled false # 기본적으로 비활성화
4504
4606
  top 14+ aa1
4505
4607
  left 1
4506
4608
  text 'URL'
4507
4609
  }
4610
+
4611
+ @data['포스트설정']['ChatGPT사용'] = checkbox('Chat GPT 사용하기'){
4612
+ top 15+ aa1
4613
+ left 0
4614
+ }
4615
+
4616
+ @data['포스트설정']['api_key'] = entry(){
4617
+ top 15+ aa1
4618
+ left 1
4619
+ text 'api key 입력 필수!!'
4620
+ }
4508
4621
  }
4509
4622
  }
4510
4623
 
@@ -4695,6 +4808,22 @@ class Wordpress
4695
4808
  @data['포스트설정']['막글삽입'] = checkbox('내용 하단에 막글 삽입'){
4696
4809
  top 6
4697
4810
  left 0
4811
+ #enabled false # 기본적으로 비활성화
4812
+ on_toggled {
4813
+ if @data['포스트설정']['막글삽입'].checked?
4814
+ @data['포스트설정']['막글투명'].enabled = true # '내용투명' 활성화
4815
+ @data['포스트설정']['막글그대로'].enabled = true # '내용투명' 활성화
4816
+ @data['포스트설정']['막글 수식에 입력'].enabled = true # '내용투명' 활성화
4817
+
4818
+ else
4819
+ @data['포스트설정']['막글투명'].checked = false # 체크 해제
4820
+ @data['포스트설정']['막글투명'].enabled = false # 비활성화
4821
+ @data['포스트설정']['막글그대로'].checked = false # 체크 해제
4822
+ @data['포스트설정']['막글그대로'].enabled = false # 비활성화
4823
+ @data['포스트설정']['막글 수식에 입력'].checked = false # 체크 해제
4824
+ @data['포스트설정']['막글 수식에 입력'].enabled = false # 비활성화
4825
+ end
4826
+ }
4698
4827
  }
4699
4828
  @data['포스트설정']['막글삽입시작숫자'] = entry{
4700
4829
  top 6
@@ -4724,10 +4853,12 @@ class Wordpress
4724
4853
  @data['포스트설정']['막글투명'] = checkbox('막글 안보이게 처리'){
4725
4854
  top 7
4726
4855
  left 0
4856
+ enabled false # 기본적으로 비활성화
4727
4857
  }
4728
4858
  @data['포스트설정']['막글그대로'] = checkbox('막글 그대로 입력'){
4729
4859
  top 7
4730
4860
  left 1
4861
+ enabled false # 기본적으로 비활성화
4731
4862
  }
4732
4863
 
4733
4864
  @data['포스트설정']['태그삽입1'] = checkbox('태그삽입'){
@@ -4752,11 +4883,19 @@ class Wordpress
4752
4883
  @data['포스트설정']['자동글 수식에 입력'] = checkbox('자동글 수식에 입력'){
4753
4884
  top 9
4754
4885
  left 0
4886
+ enabled false # 기본적으로 비활성화
4887
+ on_toggled {
4888
+ if @data['포스트설정']['자동글 수식에 입력'].checked?
4889
+ @data['포스트설정']['내용을자동생성'].checked = false
4890
+ @data['포스트설정']['내용투명'].checked = false
4891
+ end
4892
+ }
4755
4893
  }
4756
4894
 
4757
4895
  @data['포스트설정']['막글 수식에 입력'] = checkbox('막글 수식에 입력'){
4758
4896
  top 9
4759
4897
  left 1
4898
+ enabled false # 기본적으로 비활성화
4760
4899
  }
4761
4900
 
4762
4901
 
@@ -4839,10 +4978,22 @@ class Wordpress
4839
4978
  @data['포스트설정']['테더링'] = checkbox('테더링 IP 사용'){
4840
4979
  top 15
4841
4980
  left 0
4981
+ on_toggled{
4982
+ if @data['포스트설정']['테더링'].checked?
4983
+ @data['포스트설정']['프록시'].checked = false
4984
+
4985
+ end
4986
+ }
4842
4987
  }
4843
4988
  @data['포스트설정']['프록시'] = checkbox('프록시 IP 사용'){
4844
4989
  top 15
4845
4990
  left 1
4991
+ on_toggled{
4992
+ if @data['포스트설정']['프록시'].checked?
4993
+ @data['포스트설정']['테더링'].checked = false
4994
+
4995
+ end
4996
+ }
4846
4997
  }
4847
4998
  button('프록시 IP 파일 불러오기'){
4848
4999
  top 15