nblog_zon 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_zon.rb +79 -40
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd0b2bcd685cc656f2bf6d919856b94eaaf05ee83e661ac3467dc48cb24fb6f1
4
- data.tar.gz: 8ee73879e732dd5eb57d46e3fb926a3bd13495eca9a85f9d19179ce6073aa06d
3
+ metadata.gz: 8bf25a52968bb8e5c71a26e6f91d7b76573bdacd848adfed459107aaf06b97c2
4
+ data.tar.gz: 8f837cb7e5f4196d36faeb8bb37f9c5b3a3ddce23977a9d1b468eb6375e1566a
5
5
  SHA512:
6
- metadata.gz: 8aee687aac082ba1c277a1eac6d4f773065eb91ca8de02b53c349768a6c46cc3d726a1bd952e40b4e5364168036fa979e2e5f436397cc17b55f186ef811a458a
7
- data.tar.gz: 22721d56f7b5a358ab7bfa794d9d5443e81e39cb242bee45be77779f49537f0e8180ebb3ee1688c24e816cb5f3ccff7f12c1f8c666c5a9120a0cbc38d29d8dab
6
+ metadata.gz: e51b8b7ec64e77adcd135473ee25ab2ecda9ac81e662989cabc52f200067dbb8911a4ad4566ec7d9b5015b0ee770be75bc1919437d75d3b455e68e11d9e42e14
7
+ data.tar.gz: 2836a99783639fa8535676b485b5e758fd45d5eb0d2cf196cb29fc06a6e162495520e33523e66da70d62395779a6a038ec6a2eb39b02bb50da9d6e7b13f3c335
data/lib/nblog_zon.rb CHANGED
@@ -311,11 +311,11 @@ class Naver
311
311
  FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
312
312
  if proxy == ''
313
313
 
314
- 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})
314
+ 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})
315
315
 
316
316
  else
317
317
 
318
- 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})
318
+ 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})
319
319
 
320
320
  end
321
321
  end
@@ -467,29 +467,24 @@ class Naver
467
467
 
468
468
 
469
469
  chrome_start(proxy, user_id)
470
- @driver.get('https://www.naver.com')
471
- puts'[Step.01] 계정 로그인 및 세션 확인.......'.yellow
472
-
470
+
473
471
 
474
472
  sleep(1)
475
473
 
476
474
  begin
477
- wait = Selenium::WebDriver::Wait.new(:timeout => 7)
475
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5)
478
476
  #요소가 나타날 때까지 3초 동안 기다립니다.
479
- wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__btn_logout___bsTOJ"]') }
477
+ wait.until { @driver.find_element(:xpath, '//*[@class="HeaderView_email__beGsy"]') }
480
478
  sleep(1.5)
481
479
  check_cookie_login = 1
482
- puts'[Step.02] 계정 세션 확인!! 로그인 skip.......'.yellow
480
+ puts' 계정 세션 확인!! 로그인 skip.......'.yellow
483
481
  sleep(2.5)
484
482
  rescue
485
483
  begin
486
- wait = Selenium::WebDriver::Wait.new(:timeout => 7)
487
- # 요소가 나타날 때까지 기다립니다.
488
- wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]') }
484
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
485
+ wait.until { @driver.find_element(:xpath, '//*[@class="HeaderView_login_text__pFpJ_"]') }
489
486
  sleep(1.5)
490
-
491
- # 요소가 있으면 클릭
492
- @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]').click
487
+ @driver.find_element(:xpath, '//*[@class="HeaderView_login_text__pFpJ_"]').click
493
488
  check_cookie_login = 0
494
489
  sleep(1)
495
490
  rescue
@@ -499,35 +494,24 @@ class Naver
499
494
  end
500
495
 
501
496
  if check_cookie_login == 0
502
- puts'[Step.02] 계정 세션이 없거나 기간 만료로 인해 로그인 시도.......'.yellow
497
+ puts' 계정 세션이 없거나 기간 만료로 인해 로그인 시도.......'.yellow
503
498
  # @driver.find_element(:xpath, '//*[@id="right-content-area"]/div[1]/div[1]/div/a').click
504
499
  sleep(3)
505
500
  begin
506
501
  wait = Selenium::WebDriver::Wait.new(:timeout => 7)
507
502
  #요소가 나타날 때까지 3초 동안 기다립니다.
508
- wait.until { @driver.find_element(:xpath, '//*[@id="id" and @name="id"]') }
509
- @driver.find_element(:xpath, '//*[@id="id" and @name="id"]').click
503
+ wait.until { @driver.find_element(:xpath, '//*[@id="id"]') }
504
+ sleep(1.5)
505
+
506
+ @driver.find_element(:xpath, '//*[@id="id"]').click
510
507
  Clipboard.copy(user_id)
511
508
  @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
512
509
  sleep(1.5)
513
- @driver.find_element(:xpath, '//*[@id="pw" and @name="pw"]').click
510
+ @driver.find_element(:xpath, '//*[@id="pw"]').click
514
511
  Clipboard.copy(user_pw)
515
512
  @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
516
513
  sleep(1.5)
517
-
518
- begin
519
- smart_level_value = @driver.find_element(id: 'smart_LEVEL').attribute('value')
520
- if smart_level_value == '1'
521
- @driver.find_element(xpath: '//label[@for="switch" and @class="switch_btn"]').click
522
- sleep(1.5)
523
- end
524
- rescue
525
- end
526
-
527
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
528
- #요소가 나타날 때까지 3초 동안 기다립니다.
529
- wait.until { @driver.find_element(xpath: '//button[@type="submit" and @id="log.login"]') }
530
- @driver.find_element(xpath: '//button[@type="submit" and @id="log.login"]').click
514
+ @driver.find_element(:xpath, '//*[@type="submit" and @class="btn_check next_step" and @id="submit_btn"]').click
531
515
  sleep(2.5)
532
516
  rescue => e
533
517
  puts '-[√] 로딩 지연 접속 실패.......'.red
@@ -551,8 +535,7 @@ class Naver
551
535
  begin
552
536
  wait = Selenium::WebDriver::Wait.new(:timeout => 5)
553
537
  #요소가 나타날 때까지 3초 동안 기다립니다.
554
- wait.until { @driver.find_element(:xpath, '//*[@type="button" and @class="MyView-module__btn_logout___bsTOJ"]') }
555
-
538
+ wait.until { @driver.find_element(:xpath, '//*[@class="HeaderView_email__beGsy"]') }
556
539
  rescue => e
557
540
  puts '-[√] 로그인 실패.......'.red
558
541
  @driver.window_handles.each do |handle|
@@ -566,7 +549,7 @@ class Naver
566
549
  end
567
550
  return 0
568
551
  @driver.quit
569
- end
552
+ end
570
553
  end
571
554
 
572
555
  def create_id
@@ -779,7 +762,7 @@ class Naver
779
762
  end
780
763
  end
781
764
 
782
- def update(title, content, option, soosick_1, soosick_2, dd_time)
765
+ def update(title, content, option, soosick_1, soosick_2, dd_time, image_nom)
783
766
  #@driver.get(@url+'?Redirect=Write')
784
767
  #sleep(15)
785
768
  #sleep(2)
@@ -1816,6 +1799,43 @@ class Naver
1816
1799
  else
1817
1800
 
1818
1801
  end
1802
+
1803
+ if option['대표사진설정'] == 'true'
1804
+ puts "대표 사진 설정중"
1805
+ puts "대표 사진 넘버: #{image_nom}"
1806
+
1807
+ image_nom_int = image_nom.to_i # <- 여기 추가!
1808
+
1809
+ if image_nom_int < 1
1810
+ puts "⚠️ 대표사진 넘버가 잘못되었습니다. 최소값은 1입니다."
1811
+ else
1812
+ target_index = image_nom_int - 1
1813
+ begin
1814
+ wait = Selenium::WebDriver::Wait.new(timeout: 10)
1815
+ element = @driver.find_elements(:xpath, "//strong[@class='se-panel-title' and text()='라이브러리']")
1816
+ unless element.any? && element.first.displayed?
1817
+ span = wait.until {
1818
+ el = @driver.find_element(:xpath, "//span[@class='se-toolbar-label' and text()='라이브러리']")
1819
+ el if el.displayed?
1820
+ }
1821
+ span.click
1822
+ sleep(2)
1823
+ end
1824
+
1825
+ li = wait.until {
1826
+ el = @driver.find_element(:xpath, "//li[@class='se-sidebar-item' and @data-log='llib.ditmatt' and @data-index='#{target_index}']")
1827
+ el if el.displayed?
1828
+ }
1829
+ li.click
1830
+ sleep(2)
1831
+ puts "✅ 대표 사진 #{image_nom_int} 설정 완료"
1832
+ rescue => e
1833
+ puts "❌ 대표 사진 설정 중 오류: #{e.message}"
1834
+ end
1835
+ end
1836
+ else
1837
+
1838
+ end
1819
1839
 
1820
1840
 
1821
1841
  begin
@@ -3869,6 +3889,13 @@ class Wordpress
3869
3889
 
3870
3890
  end
3871
3891
 
3892
+ if @data['포스트설정']['대표사진설정'].checked?
3893
+ option['대표사진설정'] = 'true'
3894
+ image_nom = @data['포스트설정']['대표사진넘버'].text.to_s.force_encoding('utf-8')
3895
+ else
3896
+ option['대표사진설정'] = 'false'
3897
+ end
3898
+
3872
3899
  if @data['포스트설정']['라이브러리사용안함'].checked?
3873
3900
  option['라이브러리사용안함'] = 'true'
3874
3901
  else
@@ -3990,7 +4017,7 @@ class Wordpress
3990
4017
 
3991
4018
  dd_time = @data['table'][index][10].to_s.force_encoding('utf-8').to_i
3992
4019
  #template_no = @data['table'][index][7].to_s.force_encoding('utf-8').to_i
3993
- naver.update(title,content,option,soosick_1,soosick_2, dd_time)
4020
+ naver.update(title,content,option,soosick_1,soosick_2, dd_time, image_nom)
3994
4021
 
3995
4022
 
3996
4023
  # if @data['포스트설정']['태그삽입2'].checked?
@@ -5327,14 +5354,26 @@ class Wordpress
5327
5354
 
5328
5355
  horizontal_box{
5329
5356
  stretchy false
5330
- label('※이미지 리스트와 위 세팅을 하였다면 포스트설정1 탭에서 어떤위치(방식)으로 삽입시킬지 세팅이 필요합니다.'){
5331
- }
5357
+ grid{
5358
+
5359
+ @data['포스트설정']['대표사진설정'] = checkbox('대표 사진 지정하기'){
5360
+ top 0
5361
+ left 0
5362
+
5363
+ }
5364
+ @data['포스트설정']['대표사진넘버'] = entry{
5365
+ top 0
5366
+ left 1
5367
+ text '예로 2번째 사진이라면 2 입력'
5368
+ }
5369
+ }
5332
5370
  }
5333
5371
  horizontal_box{
5334
5372
  stretchy false
5335
- label('※이미지를 아래 특정단어 슬라이드 변경 기능만 사용한다면 포스트설정1 탭에서 설정을 필요는 없습니다.'){
5373
+ label('※이미지 리스트와 세팅을 하였다면 포스트설정1 탭에서 어떤위치(방식)으로 삽입시킬지 세팅이 필요합니다.'){
5336
5374
  }
5337
5375
  }
5376
+
5338
5377
  vertical_separator{
5339
5378
  stretchy false
5340
5379
  }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nblog_zon
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: rnjstnswp123@naver.com