cafe_buy_duo 0.0.37 → 0.0.39
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_buy_duo.rb +56 -26
- 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: d31236851bcf2d4dee34c03e6a241d00b94506fa3c4ec26eddd9c273a6d30dcb
|
4
|
+
data.tar.gz: 960b15432b170414ccf59240adf793eaed67b0587f60a93a19bf0e4813446092
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6422148e457afc190a2e698afda92fc73738437864427cf17717cecfab61a64b686c341dd6cc5c3c20e4bb5c8f97a67b464bcf81c2974b33a3e608c4debc1090
|
7
|
+
data.tar.gz: 61a7df43d0fd9bc65046cbfd438f01083e53ff40a5e52d6cb1430c8446ee206005a66ac895b12f0718eb5daad627961333d9384b4e1d8d9d235213eb92717103
|
data/lib/cafe_buy_duo.rb
CHANGED
@@ -2520,36 +2520,66 @@ class Wordpress
|
|
2520
2520
|
puts table[10]
|
2521
2521
|
if table[7].to_i > table[10].to_i
|
2522
2522
|
if @data['포스트설정']['테더링'].checked?
|
2523
|
-
|
2524
|
-
|
2525
|
-
|
2526
|
-
|
2527
|
-
|
2528
|
-
|
2529
|
-
|
2530
|
-
|
2531
|
-
|
2532
|
-
|
2533
|
-
|
2534
|
-
|
2535
|
-
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2523
|
+
puts 'tethering ip change...'
|
2524
|
+
|
2525
|
+
# ADB devices 확인
|
2526
|
+
stdout, stderr, status = Open3.capture3('./adb devices')
|
2527
|
+
if status.success?
|
2528
|
+
device_id = stdout.split("\n")[1].split("\t")[0]
|
2529
|
+
puts device_id
|
2530
|
+
puts 'adb -s ' + device_id + ' shell svc data disable'
|
2531
|
+
|
2532
|
+
stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
|
2533
|
+
if status2.success?
|
2534
|
+
sleep(3)
|
2535
|
+
puts 'adb -s ' + device_id + ' shell svc data enable'
|
2536
|
+
Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
|
2537
|
+
sleep(3)
|
2538
|
+
puts 'adb ok'
|
2539
|
+
sleep(8)
|
2540
|
+
|
2541
|
+
# IP 확인 및 재시도 (반복문 사용)
|
2542
|
+
retry_count = 0
|
2543
|
+
max_retries = 5
|
2544
|
+
current_ip = nil
|
2545
|
+
|
2546
|
+
# 무한 루프 방지
|
2547
|
+
while retry_count < max_retries
|
2548
|
+
begin
|
2549
|
+
http = HTTP.get('https://www.findip.kr/')
|
2550
|
+
noko = Nokogiri::HTML(http.to_s)
|
2551
|
+
new_ip = noko.xpath('/html/body/header/h2').text.strip
|
2552
|
+
|
2553
|
+
puts "Current IP: #{@my_ip}, New IP: #{new_ip}"
|
2554
|
+
|
2555
|
+
# IP가 변경되었으면 @my_ip를 갱신하고 종료
|
2556
|
+
if new_ip != @my_ip
|
2557
|
+
@my_ip = new_ip
|
2558
|
+
puts "IP 변경됨: #{@my_ip}"
|
2559
|
+
break
|
2560
|
+
else
|
2561
|
+
puts 'IP가 변경되지 않음. 재시도...'
|
2562
|
+
retry_count += 1
|
2563
|
+
sleep(3) # 3초 후 재시도
|
2564
|
+
end
|
2565
|
+
rescue => e
|
2566
|
+
retry_count += 1
|
2567
|
+
sleep(3) # 3초 후 재시도
|
2568
|
+
end
|
2569
|
+
|
2570
|
+
# 최대 재시도 횟수를 초과하면 예외 발생시키기
|
2571
|
+
if retry_count >= max_retries
|
2572
|
+
raise "최대 재시도 횟수 초과. IP 변경 실패."
|
2547
2573
|
end
|
2548
|
-
|
2574
|
+
end
|
2549
2575
|
else
|
2550
|
-
|
2576
|
+
puts 'Failed to disable data. Error: ' + stderr2
|
2551
2577
|
end
|
2578
|
+
else
|
2579
|
+
puts 'adb error, unable to get devices. Error: ' + stderr
|
2580
|
+
end
|
2552
2581
|
end
|
2582
|
+
|
2553
2583
|
|
2554
2584
|
check_success = 1
|
2555
2585
|
@data['table'][index][-1] = 0
|