cafe_basics_duo 0.0.39 → 0.0.50
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.
- checksums.yaml +4 -4
- data/lib/cafe_basics_duo.rb +63 -51
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f897fe72200a4eb5048bf8743bbffaa985971fa930ff67a32d51df2b026bc91
|
4
|
+
data.tar.gz: 9c94429b6e70b037974ed48c776095487f81f76731887b186cf82b0cda19d4f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee0cae2823090f316c699afc9948d27d193e7575ed28786a11284d10e68b4fa30148cf78e686459471a0bfd4cc7e3cb2cd546dadd569b1d8976e4432f9722a6c
|
7
|
+
data.tar.gz: 193aa1f21ee97af821c6dabee753e94f9d3b6d0fef43ef1f06b589cfb595e3c15f5f58f0ac44e9621c27b3711adc37aa469e41c94c1070d4708ffa77915cce09
|
data/lib/cafe_basics_duo.rb
CHANGED
@@ -2190,65 +2190,77 @@ class Wordpress
|
|
2190
2190
|
puts table[10]
|
2191
2191
|
if table[7].to_i > table[10].to_i
|
2192
2192
|
if @data['포스트설정']['테더링'].checked?
|
2193
|
-
|
2194
|
-
|
2195
|
-
|
2196
|
-
|
2197
|
-
|
2198
|
-
|
2199
|
-
|
2200
|
-
|
2201
|
-
|
2202
|
-
|
2203
|
-
|
2204
|
-
sleep(
|
2205
|
-
|
2206
|
-
|
2207
|
-
|
2208
|
-
|
2209
|
-
sleep(
|
2210
|
-
|
2211
|
-
#
|
2212
|
-
|
2213
|
-
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
|
2218
|
-
|
2219
|
-
|
2220
|
-
|
2221
|
-
|
2222
|
-
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2226
|
-
|
2227
|
-
|
2228
|
-
|
2229
|
-
|
2230
|
-
|
2231
|
-
|
2193
|
+
puts 'tethering ip change...'
|
2194
|
+
|
2195
|
+
# ADB devices 확인
|
2196
|
+
stdout, stderr, status = Open3.capture3('./adb devices')
|
2197
|
+
if status.success?
|
2198
|
+
device_id = stdout.split("\n")[1].split("\t")[0]
|
2199
|
+
puts device_id
|
2200
|
+
|
2201
|
+
# ADB 서버 초기화
|
2202
|
+
puts 'adb kill-server'
|
2203
|
+
Open3.capture3('adb kill-server')
|
2204
|
+
sleep(2)
|
2205
|
+
|
2206
|
+
# 다시 ADB 서버 실행
|
2207
|
+
puts 'adb start-server'
|
2208
|
+
Open3.capture3('adb start-server')
|
2209
|
+
sleep(2)
|
2210
|
+
|
2211
|
+
# 데이터를 끄고 켜기
|
2212
|
+
puts 'adb -s ' + device_id + ' shell svc data disable'
|
2213
|
+
stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
|
2214
|
+
|
2215
|
+
if status2.success?
|
2216
|
+
sleep(3)
|
2217
|
+
puts 'adb -s ' + device_id + ' shell svc data enable'
|
2218
|
+
Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
|
2219
|
+
sleep(3)
|
2220
|
+
puts 'adb ok'
|
2221
|
+
sleep(8)
|
2222
|
+
|
2223
|
+
# IP 확인 및 재시도 (반복문 사용)
|
2224
|
+
retry_count = 0
|
2225
|
+
max_retries = 5
|
2226
|
+
current_ip = nil
|
2227
|
+
|
2228
|
+
# 무한 루프 방지
|
2229
|
+
while retry_count < max_retries
|
2230
|
+
begin
|
2231
|
+
http = HTTP.get('https://www.findip.kr/')
|
2232
|
+
noko = Nokogiri::HTML(http.to_s)
|
2233
|
+
new_ip = noko.xpath('/html/body/header/h2').text.strip
|
2234
|
+
|
2235
|
+
puts "Current IP: #{@my_ip}, New IP: #{new_ip}"
|
2236
|
+
|
2237
|
+
# IP가 변경되었으면 @my_ip를 갱신하고 종료
|
2238
|
+
if new_ip != @my_ip
|
2239
|
+
@my_ip = new_ip
|
2240
|
+
puts "IP 변경됨: #{@my_ip}"
|
2241
|
+
break
|
2242
|
+
else
|
2243
|
+
puts 'IP가 변경되지 않음. 재시도...'
|
2244
|
+
retry_count += 1
|
2245
|
+
sleep(3) # 3초 후 재시도
|
2246
|
+
end
|
2247
|
+
rescue => e
|
2232
2248
|
retry_count += 1
|
2233
2249
|
sleep(3) # 3초 후 재시도
|
2234
2250
|
end
|
2235
|
-
|
2236
|
-
|
2237
|
-
|
2238
|
-
|
2239
|
-
|
2240
|
-
# 최대 재시도 횟수를 초과하면 예외 발생시키기
|
2241
|
-
if retry_count >= max_retries
|
2242
|
-
raise "최대 재시도 횟수 초과. IP 변경 실패."
|
2251
|
+
|
2252
|
+
# 최대 재시도 횟수를 초과하면 예외 발생시키기
|
2253
|
+
if retry_count >= max_retries
|
2254
|
+
raise "최대 재시도 횟수 초과. IP 변경 실패."
|
2255
|
+
end
|
2243
2256
|
end
|
2257
|
+
else
|
2258
|
+
puts 'Failed to disable data. Error: ' + stderr2
|
2244
2259
|
end
|
2245
2260
|
else
|
2246
|
-
puts '
|
2261
|
+
puts 'adb error, unable to get devices. Error: ' + stderr
|
2247
2262
|
end
|
2248
|
-
else
|
2249
|
-
puts 'adb error, unable to get devices. Error: ' + stderr
|
2250
2263
|
end
|
2251
|
-
end
|
2252
2264
|
|
2253
2265
|
|
2254
2266
|
check_success = 1
|