nblog_duo 111.120.009 → 111.120.011

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/nblog_duo.rb +78 -39
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 843cb7a347f451a0b986d2e758fea5cb4a0150c0db432ab4e34d4d425ecad341
4
- data.tar.gz: c20bdfad6c851c13c92bdffdc65fab30153e178b9557b728efedefd5629d31f1
3
+ metadata.gz: bbb7d23581635e0dc4567822425e38233d992073f18f4bb73971a37411ef317e
4
+ data.tar.gz: 1342c24281884a9c8fa4552c7cb6618217131125d781ff8345eb473e92e0b466
5
5
  SHA512:
6
- metadata.gz: 00d8692a4a1fc7bf996479be315232fb0177fb8fe9e2703d2e1d9ce8df69f1cccd56b27c1889e0cfdc031b4c4f32117996faa9c53187288476ce53a149bb42b4
7
- data.tar.gz: ee87f70b88957e83d212c241bc0174238ba6f22c68998765c004ae34edcfbeeeddfb31664886305c1fe654c84ae46a1373f347bee48859bf3502a9cbaf2c4873
6
+ metadata.gz: 59ac574defbd7230e7bf406bb905ffd712af17061ce28507ee019cd06a8b2c3ba208bbdc26faef56618a7249f7fb332d775f1d32a5f68423e2e40da3ba99ddda
7
+ data.tar.gz: e1b76cfb061e33f0eb56b850b0577baac76f49753a7b116474847adb473a0869d25fc58a389204aacd20f14f549848f25077cb45b9e995f8244f9577bee1c82c
data/lib/nblog_duo.rb CHANGED
@@ -313,11 +313,11 @@ class Naver
313
313
  FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
314
314
  if proxy == ''
315
315
 
316
- system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --no-first-run --no-default-browser-check --disable-sync})
316
+ system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://my.naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --no-first-run --no-default-browser-check --disable-sync})
317
317
 
318
318
  else
319
319
 
320
- system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --proxy-server=#{proxy.to_s.force_encoding('utf-8').to_s} --no-first-run --no-default-browser-check --disable-sync})
320
+ system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://my.naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --proxy-server=#{proxy.to_s.force_encoding('utf-8').to_s} --no-first-run --no-default-browser-check --disable-sync})
321
321
 
322
322
  end
323
323
  end
@@ -469,29 +469,24 @@ class Naver
469
469
 
470
470
 
471
471
  chrome_start(proxy, user_id)
472
- @driver.get('https://www.naver.com')
473
- puts'[Step.01] 계정 로그인 및 세션 확인.......'.yellow
474
-
472
+
475
473
 
476
474
  sleep(1)
477
475
 
478
476
  begin
479
- wait = Selenium::WebDriver::Wait.new(:timeout => 7)
477
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5)
480
478
  #요소가 나타날 때까지 3초 동안 기다립니다.
481
- wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__btn_logout___bsTOJ"]') }
479
+ wait.until { @driver.find_element(:xpath, '//*[@class="HeaderView_email__beGsy"]') }
482
480
  sleep(1.5)
483
481
  check_cookie_login = 1
484
- puts'[Step.02] 계정 세션 확인!! 로그인 skip.......'.yellow
482
+ puts' 계정 세션 확인!! 로그인 skip.......'.yellow
485
483
  sleep(2.5)
486
484
  rescue
487
485
  begin
488
- wait = Selenium::WebDriver::Wait.new(:timeout => 7)
489
- # 요소가 나타날 때까지 기다립니다.
490
- wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]') }
486
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
487
+ wait.until { @driver.find_element(:xpath, '//*[@class="HeaderView_login_text__pFpJ_"]') }
491
488
  sleep(1.5)
492
-
493
- # 요소가 있으면 클릭
494
- @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]').click
489
+ @driver.find_element(:xpath, '//*[@class="HeaderView_login_text__pFpJ_"]').click
495
490
  check_cookie_login = 0
496
491
  sleep(1)
497
492
  rescue
@@ -501,35 +496,24 @@ class Naver
501
496
  end
502
497
 
503
498
  if check_cookie_login == 0
504
- puts'[Step.02] 계정 세션이 없거나 기간 만료로 인해 로그인 시도.......'.yellow
499
+ puts' 계정 세션이 없거나 기간 만료로 인해 로그인 시도.......'.yellow
505
500
  # @driver.find_element(:xpath, '//*[@id="right-content-area"]/div[1]/div[1]/div/a').click
506
501
  sleep(3)
507
502
  begin
508
503
  wait = Selenium::WebDriver::Wait.new(:timeout => 7)
509
504
  #요소가 나타날 때까지 3초 동안 기다립니다.
510
- wait.until { @driver.find_element(:xpath, '//*[@id="id" and @name="id"]') }
511
- @driver.find_element(:xpath, '//*[@id="id" and @name="id"]').click
505
+ wait.until { @driver.find_element(:xpath, '//*[@id="id"]') }
506
+ sleep(1.5)
507
+
508
+ @driver.find_element(:xpath, '//*[@id="id"]').click
512
509
  Clipboard.copy(user_id)
513
510
  @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
514
511
  sleep(1.5)
515
- @driver.find_element(:xpath, '//*[@id="pw" and @name="pw"]').click
512
+ @driver.find_element(:xpath, '//*[@id="pw"]').click
516
513
  Clipboard.copy(user_pw)
517
514
  @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
518
515
  sleep(1.5)
519
-
520
- begin
521
- smart_level_value = @driver.find_element(id: 'smart_LEVEL').attribute('value')
522
- if smart_level_value == '1'
523
- @driver.find_element(xpath: '//label[@for="switch" and @class="switch_btn"]').click
524
- sleep(1.5)
525
- end
526
- rescue
527
- end
528
-
529
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
530
- #요소가 나타날 때까지 3초 동안 기다립니다.
531
- wait.until { @driver.find_element(xpath: '//button[@type="submit" and @id="log.login"]') }
532
- @driver.find_element(xpath: '//button[@type="submit" and @id="log.login"]').click
516
+ @driver.find_element(:xpath, '//*[@type="submit" and @class="btn_check next_step" and @id="submit_btn"]').click
533
517
  sleep(2.5)
534
518
  rescue => e
535
519
  puts '-[√] 로딩 지연 접속 실패.......'.red
@@ -553,8 +537,7 @@ class Naver
553
537
  begin
554
538
  wait = Selenium::WebDriver::Wait.new(:timeout => 5)
555
539
  #요소가 나타날 때까지 3초 동안 기다립니다.
556
- wait.until { @driver.find_element(:xpath, '//*[@type="button" and @class="MyView-module__btn_logout___bsTOJ"]') }
557
-
540
+ wait.until { @driver.find_element(:xpath, '//*[@class="HeaderView_email__beGsy"]') }
558
541
  rescue => e
559
542
  puts '-[√] 로그인 실패.......'.red
560
543
  @driver.window_handles.each do |handle|
@@ -781,7 +764,7 @@ class Naver
781
764
  end
782
765
  end
783
766
 
784
- def update(title, content, option, soosick_1, soosick_2, dd_time)
767
+ def update(title, content, option, soosick_1, soosick_2, dd_time, image_nom)
785
768
  #@driver.get(@url+'?Redirect=Write')
786
769
  #sleep(15)
787
770
  #sleep(2)
@@ -1818,6 +1801,43 @@ class Naver
1818
1801
  else
1819
1802
 
1820
1803
  end
1804
+
1805
+ if option['대표사진설정'] == 'true'
1806
+ puts "대표 사진 설정중"
1807
+ puts "대표 사진 넘버: #{image_nom}"
1808
+
1809
+ image_nom_int = image_nom.to_i # <- 여기 추가!
1810
+
1811
+ if image_nom_int < 1
1812
+ puts "⚠️ 대표사진 넘버가 잘못되었습니다. 최소값은 1입니다."
1813
+ else
1814
+ target_index = image_nom_int - 1
1815
+ begin
1816
+ wait = Selenium::WebDriver::Wait.new(timeout: 10)
1817
+ element = @driver.find_elements(:xpath, "//strong[@class='se-panel-title' and text()='라이브러리']")
1818
+ unless element.any? && element.first.displayed?
1819
+ span = wait.until {
1820
+ el = @driver.find_element(:xpath, "//span[@class='se-toolbar-label' and text()='라이브러리']")
1821
+ el if el.displayed?
1822
+ }
1823
+ span.click
1824
+ sleep(2)
1825
+ end
1826
+
1827
+ li = wait.until {
1828
+ el = @driver.find_element(:xpath, "//li[@class='se-sidebar-item' and @data-log='llib.ditmatt' and @data-index='#{target_index}']")
1829
+ el if el.displayed?
1830
+ }
1831
+ li.click
1832
+ sleep(2)
1833
+ puts "✅ 대표 사진 #{image_nom_int} 설정 완료"
1834
+ rescue => e
1835
+ puts "❌ 대표 사진 설정 중 오류: #{e.message}"
1836
+ end
1837
+ end
1838
+ else
1839
+
1840
+ end
1821
1841
 
1822
1842
 
1823
1843
  begin
@@ -3940,6 +3960,13 @@ class Wordpress
3940
3960
 
3941
3961
  end
3942
3962
 
3963
+ if @data['포스트설정']['대표사진설정'].checked?
3964
+ option['대표사진설정'] = 'true'
3965
+ image_nom = @data['포스트설정']['대표사진넘버'].text.to_s.force_encoding('utf-8')
3966
+ else
3967
+ option['대표사진설정'] = 'false'
3968
+ end
3969
+
3943
3970
  if @data['포스트설정']['라이브러리사용안함'].checked?
3944
3971
  option['라이브러리사용안함'] = 'true'
3945
3972
  else
@@ -4061,7 +4088,7 @@ class Wordpress
4061
4088
 
4062
4089
  dd_time = @data['table'][index][10].to_s.force_encoding('utf-8').to_i
4063
4090
  #template_no = @data['table'][index][7].to_s.force_encoding('utf-8').to_i
4064
- naver.update(title,content,option,soosick_1,soosick_2, dd_time)
4091
+ naver.update(title,content,option,soosick_1,soosick_2, dd_time, image_nom)
4065
4092
 
4066
4093
 
4067
4094
  # if @data['포스트설정']['태그삽입2'].checked?
@@ -5404,14 +5431,26 @@ class Wordpress
5404
5431
 
5405
5432
  horizontal_box{
5406
5433
  stretchy false
5407
- label('※이미지 리스트와 위 세팅을 하였다면 포스트설정1 탭에서 어떤위치(방식)으로 삽입시킬지 세팅이 필요합니다.'){
5408
- }
5434
+ grid{
5435
+
5436
+ @data['포스트설정']['대표사진설정'] = checkbox('대표 사진 지정하기'){
5437
+ top 0
5438
+ left 0
5439
+
5440
+ }
5441
+ @data['포스트설정']['대표사진넘버'] = entry{
5442
+ top 0
5443
+ left 1
5444
+ text '예로 2번째 사진이라면 2 입력'
5445
+ }
5446
+ }
5409
5447
  }
5410
5448
  horizontal_box{
5411
5449
  stretchy false
5412
- label('※이미지를 아래 특정단어 슬라이드 변경 기능만 사용한다면 포스트설정1 탭에서 설정을 필요는 없습니다.'){
5450
+ label('※이미지 리스트와 세팅을 하였다면 포스트설정1 탭에서 어떤위치(방식)으로 삽입시킬지 세팅이 필요합니다.'){
5413
5451
  }
5414
5452
  }
5453
+
5415
5454
  vertical_separator{
5416
5455
  stretchy false
5417
5456
  }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nblog_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 111.120.009
4
+ version: 111.120.011
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-07-08 00:00:00.000000000 Z
10
+ date: 2025-07-15 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: File to Clipboard gem
13
13
  email: mymin26@naver.com