posting_zon 0.0.17 → 0.0.25

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/posting_zon.rb +157 -124
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa2533bb6288331d2e9f17bd3d42e197b0d65bbdff799764aff55aae382983e5
4
- data.tar.gz: 14557a4859bb61806f99018823ea7ed81e91a2865735e94b762a152ab62598e0
3
+ metadata.gz: 6a06373e423555fc76d617436954c3f1d75868de7ac37fcbe1537de15998e8b5
4
+ data.tar.gz: 5ea1a01e77f29e58009dde7a5006a9af38b75307c17e44b58e021dd0daad2473
5
5
  SHA512:
6
- metadata.gz: d14a0bfee39a1eaa4cf68ade7c3baac863ea5d5d4778461cb01ef9557c5ff445f239da379a07b7ca7df9b24304bfb336156a714b1b9d6ebbba893585452fa7d7
7
- data.tar.gz: fe2be34f9dc2633fb2ea22e422a14134972fb704d61c5aa5ffd7471a901e40f634c345e710e59b88965f5c7f0659b4bdb504bfe681ee8704952dadfd5be59e82
6
+ metadata.gz: bd005a21fa2654f6b68c7953ce5f53d33aa692bac3a1b4100a56f2ae5d5fb4552d211fbd9cf15885e9f3c963a765e9c321a7401ef77edc22fda06eebc95a65da
7
+ data.tar.gz: c8c862721ed7fa200f23e1a565c304b18d14ccb1bea38139fb54f745be30d57c794d4fd17fbca056a9b607525d1793fd3ef7abe81dba84e92273d93b4ada77d1
data/lib/posting_zon.rb CHANGED
@@ -30,115 +30,123 @@ require 'watir'
30
30
  #driver.find_element(:class_name, 'highlight-java')
31
31
 
32
32
  class Naver
33
-
34
- def chrome_start(proxy)
35
- if proxy == ''
36
- begin
37
- #Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
38
-
39
- options = Selenium::WebDriver::Chrome::Options.new #(options: {"excludeSwitches" => ["enable-automation"]}) #자동화된 테스트...제거(options: {"excludeSwitches" => ["enable-automation"]})
40
- options.add_extension('./crx/free.crx')
41
- options.add_extension('./crx/app.crx')
42
-
43
- options.add_argument('--start-maximized')
44
- options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.59 Safari/537.36') # user-agent 위조
45
- options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
46
- options.add_argument('--ignore-certificate-errors') #SSL 인증서 오류를 무시하도록 설정합니다
47
- options.add_argument('--disable-web-security') #웹 보안을 비활성화합니다
48
- options.add_argument('--allow-running-insecure-content') #HTTPS 사이트에서 HTTP 컨텐츠를 실행할 수 있도록 허용합니다.
49
- options.add_argument('--no-sandbox') #Chrome에서 샌드박스 모드를 비활성화합니다.
50
-
51
- # 자동화된 테스트 제거
52
- options.exclude_switches = ['enable-automation']
53
-
54
- options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
55
- options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
56
- #options.add_preference("profile.managed_default_content_settings.cookies", 2) # 쿠키 관련 팝업 차단
57
- options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
58
- options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
59
- # `capabilities` 사용
60
- capabilities = [options]
61
-
62
- # 드라이버 초기화 (capabilities 사용)
63
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
64
-
65
- rescue
66
- # `capabilities` 사용
67
- capabilities = [options]
68
33
 
69
- # 드라이버 초기화 (capabilities 사용)
70
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
71
- end
72
- else
73
- begin
74
- puts '프록시 연결합니다.......'.magenta
75
- puts '프록시 연결시 프록시 서버에 의해 인터넷속도가 낮아질수있어.......'.magenta
76
- puts '원활한 작업이 되지않을수있습니다.......'.magenta
77
- #Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
78
- options = Selenium::WebDriver::Chrome::Options.new
79
- options.add_argument '--proxy-server='+proxy.to_s.force_encoding('utf-8').to_s
80
- options.add_extension('./crx/free.crx')
81
- options.add_extension('./crx/app.crx')
82
-
83
- options.add_argument('--start-maximized')
84
- options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.59 Safari/537.36') # user-agent 위조
85
- options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
86
- options.add_argument('--ignore-certificate-errors') #SSL 인증서 오류를 무시하도록 설정합니다
87
- options.add_argument('--disable-web-security') #웹 보안을 비활성화합니다
88
- options.add_argument('--allow-running-insecure-content') #HTTPS 사이트에서 HTTP 컨텐츠를 실행할 수 있도록 허용합니다.
89
- options.add_argument('--no-sandbox') #Chrome에서 샌드박스 모드를 비활성화합니다.
90
-
91
- # 자동화된 테스트 제거
92
- options.exclude_switches = ['enable-automation']
93
-
94
- options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
95
- options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
96
- #options.add_preference("profile.managed_default_content_settings.cookies", 2) # 쿠키 관련 팝업 차단
97
- options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
98
- options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
99
- # `capabilities` 사용
100
- capabilities = [options]
101
-
102
- # 드라이버 초기화 (capabilities 사용)
103
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
104
- rescue => e
105
- puts e
106
- puts 'proxy error...'
107
- begin
108
- #Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
109
- options.add_extension('./crx/free.crx')
110
- options.add_extension('./crx/app.crx')
111
-
112
- options.add_argument('--start-maximized')
113
- options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.59 Safari/537.36') # user-agent 위조
114
- options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
115
- options.add_argument('--ignore-certificate-errors') #SSL 인증서 오류를 무시하도록 설정합니다
116
- options.add_argument('--disable-web-security') #웹 보안을 비활성화합니다
117
- options.add_argument('--allow-running-insecure-content') #HTTPS 사이트에서 HTTP 컨텐츠를 실행할 수 있도록 허용합니다.
118
- options.add_argument('--no-sandbox') #Chrome에서 샌드박스 모드를 비활성화합니다.
119
-
120
- # 자동화된 테스트 제거
121
- options.exclude_switches = ['enable-automation']
122
-
123
- options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
124
- options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
125
- #options.add_preference("profile.managed_default_content_settings.cookies", 2) # 쿠키 관련 팝업 차단
126
- options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
127
- options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
128
- # `capabilities` 사용
129
- capabilities = [options]
130
-
131
- # 드라이버 초기화 (capabilities 사용)
132
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
133
- rescue
134
- # `capabilities` 사용
135
- capabilities = [options]
136
-
137
- # 드라이버 초기화 (capabilities 사용)
138
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
139
- end
140
- end
34
+ def chrome_start(proxy)
35
+ # ChromeDriver 경로 수동 지정
36
+ chromedriver_path = './chromedriver.exe'
37
+
38
+ # 웹드라이버 자동 업데이트 시도
39
+ begin
40
+ # webdrivers가 사용자의 Chrome 버전에 맞는 chromedriver 다운로드 시도
41
+ Webdrivers::Chromedriver.update # 자동 업데이트 시도
42
+ rescue => e
43
+ puts "webdrivers에서 chromedriver 다운로드 실패: #{e.message}"
44
+ puts " 자동으로 chromedriver.exe 사용합니다."
45
+ puts "만일 프로그램 폴더안에 chromedriver.exe 버전이 맞지 않거나 없는 경우"
46
+ puts "https://storage.googleapis.com/chrome-for-testing-public/사용자크롬버전/win32/chromedriver-win32.zip 링크를 복사 후 복사 된 링크 중(사용자크롬버전) 부분을 크롬 사용자의 버전(예:131.0.6778.264)으로 수정 후 주소입력 부분에 넣어 엔터 후 다운로드 하고 압축을 풀고 chromedriver.exe 파일만 프로그램 폴더안에 넣어주세요."
47
+ # 예외가 발생하면 수동 경로 사용
48
+ Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
49
+ end
50
+
51
+ if proxy == ''
52
+ begin
53
+ # Chrome 옵션 설정
54
+ options = Selenium::WebDriver::Chrome::Options.new
55
+ options.add_extension('./crx/free.crx')
56
+ options.add_extension('./crx/app.crx')
57
+ options.add_argument('--disable-gpu')
58
+ options.add_argument('--start-maximized')
59
+ options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.59 Safari/537.36') # user-agent 위조
60
+ options.add_argument('--disable-blink-features=AutomationControlled') # 자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
61
+ options.add_argument('--ignore-certificate-errors') # SSL 인증서 오류 무시
62
+ options.add_argument('--disable-web-security') # 보안 비활성화
63
+ options.add_argument('--allow-running-insecure-content') # HTTPS 사이트에서 HTTP 컨텐츠 실행 허용
64
+ options.add_argument('--no-sandbox') # 샌드박스 모드 비활성화
65
+
66
+ options.exclude_switches = ['enable-automation'] # 자동화 테스트 제거
67
+ options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
68
+ options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
69
+ options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
70
+ options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
71
+
72
+ # 드라이버 초기화
73
+ capabilities = [options]
74
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
75
+ rescue => e
76
+ puts "Error during initialization: #{e.message}"
77
+ # 예외 발생 시, 수동으로 chromedriver 경로 설정
78
+ Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
79
+ options = Selenium::WebDriver::Chrome::Options.new
80
+ options.add_extension('./crx/free.crx')
81
+ options.add_extension('./crx/app.crx')
82
+ options.add_argument('--disable-gpu')
83
+ options.add_argument('--start-maximized')
84
+ options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.59 Safari/537.36')
85
+ options.add_argument('--disable-blink-features=AutomationControlled')
86
+ options.add_argument('--ignore-certificate-errors')
87
+ options.add_argument('--disable-web-security')
88
+ options.add_argument('--allow-running-insecure-content')
89
+ options.add_argument('--no-sandbox')
90
+
91
+ options.exclude_switches = ['enable-automation']
92
+ options.add_preference("profile.password_manager_enabled", false)
93
+ options.add_preference("credentials_enable_service", false)
94
+ options.add_preference("profile.default_content_setting_values.notifications", 2)
95
+ options.add_argument("--disable-save-password-bubble")
96
+
97
+ # 드라이버 초기화
98
+ capabilities = [options]
99
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
141
100
  end
101
+ else
102
+ begin
103
+ puts '프록시 연결합니다.......'.magenta
104
+ options = Selenium::WebDriver::Chrome::Options.new
105
+ options.add_argument '--proxy-server=' + proxy.to_s.force_encoding('utf-8').to_s
106
+ options.add_extension('./crx/free.crx')
107
+ options.add_extension('./crx/app.crx')
108
+ options.add_argument('--disable-gpu')
109
+ options.add_argument('--start-maximized')
110
+ options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.59 Safari/537.36')
111
+ options.add_argument('--disable-blink-features=AutomationControlled')
112
+ options.add_argument('--ignore-certificate-errors')
113
+ options.add_argument('--disable-web-security')
114
+ options.add_argument('--allow-running-insecure-content')
115
+ options.add_argument('--no-sandbox')
116
+
117
+ options.exclude_switches = ['enable-automation']
118
+ options.add_preference("profile.password_manager_enabled", false)
119
+ options.add_preference("credentials_enable_service", false)
120
+ options.add_preference("profile.default_content_setting_values.notifications", 2)
121
+ options.add_argument("--disable-save-password-bubble")
122
+
123
+ capabilities = [options]
124
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
125
+ rescue => e
126
+ puts "Proxy error: #{e.message}"
127
+ # 예외 발생 시 수동으로 chromedriver 경로 설정
128
+ Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
129
+ options.add_extension('./crx/free.crx')
130
+ options.add_extension('./crx/app.crx')
131
+ options.add_argument('--disable-gpu')
132
+ options.add_argument('--start-maximized')
133
+ options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.59 Safari/537.36')
134
+ options.add_argument('--disable-blink-features=AutomationControlled')
135
+ options.add_argument('--ignore-certificate-errors')
136
+ options.add_argument('--disable-web-security')
137
+ options.add_argument('--allow-running-insecure-content')
138
+ options.add_argument('--no-sandbox')
139
+
140
+ options.exclude_switches = ['enable-automation']
141
+ options.add_preference("profile.password_manager_enabled", false)
142
+ options.add_preference("credentials_enable_service", false)
143
+ options.add_preference("profile.default_content_setting_values.notifications", 2)
144
+ options.add_argument("--disable-save-password-bubble")
145
+
146
+ capabilities = [options]
147
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
148
+ end
149
+ end
142
150
  end
143
151
 
144
152
 
@@ -10382,18 +10390,33 @@ class Wordpress
10382
10390
  }
10383
10391
  button('   폴더째로 불러오기   '){
10384
10392
  stretchy false
10385
- on_clicked{
10386
- path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
10387
- Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
10388
- if file == '.' or file == '..'
10393
+ on_clicked {
10394
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')
10389
10395
 
10390
- else
10391
- file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
10392
- @data['내용설정']['내용'] << [false, file, file_data]
10396
+ # 경로가 유효한지 확인
10397
+ if Dir.exist?(path)
10398
+ Dir.entries(path).each do |file|
10399
+ if file == '.' or file == '..'
10400
+ next
10401
+ else
10402
+ begin
10403
+ # 파일을 열고 내용을 읽어서 추가
10404
+ file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
10405
+ @data['내용설정']['내용'] << [false, file, file_data]
10406
+ rescue => e
10407
+ # 파일을 열 수 없는 경우, 오류 메시지 출력
10408
+ puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
10409
+ end
10410
+ end
10393
10411
  end
10412
+
10413
+ # 내용 배열에서 마지막 빈 항목 제거
10414
+ @data['내용설정']['내용'] << []
10415
+ @data['내용설정']['내용'].pop
10416
+ else
10417
+ # 경로가 유효하지 않을 경우, 오류 메시지 출력
10418
+ puts "경로가 존재하지 않습니다: #{path}"
10394
10419
  end
10395
- @data['내용설정']['내용'] << []
10396
- @data['내용설정']['내용'].pop
10397
10420
  }
10398
10421
  }
10399
10422
  }
@@ -10480,17 +10503,27 @@ class Wordpress
10480
10503
  }
10481
10504
  button('폴더째로불러오기'){
10482
10505
  stretchy false
10483
- on_clicked{
10484
- path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
10485
- Dir.entries(@data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')).each do |file|
10486
- if file == '.' or file == '..'
10506
+ on_clicked {
10507
+ path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')
10487
10508
 
10488
- else
10489
- @data['이미지설정']['이미지'] << [false, file, path+"\\"+file.force_encoding('utf-8')]
10509
+ # 경로가 유효한지 확인
10510
+ if Dir.exist?(path)
10511
+ Dir.entries(path).each do |file|
10512
+ if file == '.' or file == '..'
10513
+ next
10514
+ else
10515
+ # 폴더 내의 파일을 이미지 리스트에 추가
10516
+ @data['이미지설정']['이미지'] << [false, file, path + "\\" + file.force_encoding('utf-8')]
10517
+ end
10490
10518
  end
10519
+
10520
+ # 마지막 빈 항목 추가 후 제거 (원래 로직에 맞춰)
10521
+ @data['이미지설정']['이미지'] << []
10522
+ @data['이미지설정']['이미지'].pop
10523
+ else
10524
+ # 경로가 존재하지 않으면 경고 메시지 출력
10525
+ puts "경로가 존재하지 않습니다: #{path}"
10491
10526
  end
10492
- @data['이미지설정']['이미지'] << []
10493
- @data['이미지설정']['이미지'].pop
10494
10527
  }
10495
10528
  }
10496
10529
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posting_zon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-09 00:00:00.000000000 Z
11
+ date: 2025-01-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: posting app
14
14
  email: mymin26@naver.com