cafe_buy 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.rb +56 -27
- 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: 770e4ff2cb7dc9f603cc0e1c550f9e81ab69bf935fd079ce1dc40dd69e0a5a19
|
4
|
+
data.tar.gz: dc94edba8336c8e6367e641026c12a7c67d33f158c5b6651a0f8ccddc894f1e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a513632a966cb20bf9877e98e19d3d9001a7dd9e53ba9cd6af7565a29a88a6c7ca6292ddd5dcc923742f49b515d0728159bd36e45c8df84e2f8511f2659daca8
|
7
|
+
data.tar.gz: ff1f5f3aea886cf248d2a64240665194275b91459d0daf50222fbad7e9c64bd52a7642959362676aedbd2e1f4814cdc6f732b9dfe66aeb1e5120c0ba5ed7b859
|
data/lib/cafe_buy.rb
CHANGED
@@ -2452,37 +2452,66 @@ class Wordpress
|
|
2452
2452
|
puts table[10]
|
2453
2453
|
if table[7].to_i > table[10].to_i
|
2454
2454
|
if @data['포스트설정']['테더링'].checked?
|
2455
|
-
|
2456
|
-
|
2457
|
-
|
2458
|
-
|
2459
|
-
|
2460
|
-
|
2461
|
-
|
2462
|
-
|
2463
|
-
|
2464
|
-
|
2465
|
-
|
2466
|
-
|
2467
|
-
|
2468
|
-
|
2469
|
-
|
2470
|
-
|
2471
|
-
|
2472
|
-
|
2473
|
-
|
2474
|
-
|
2475
|
-
|
2476
|
-
|
2477
|
-
|
2478
|
-
|
2455
|
+
puts 'tethering ip change...'
|
2456
|
+
|
2457
|
+
# ADB devices 확인
|
2458
|
+
stdout, stderr, status = Open3.capture3('./adb devices')
|
2459
|
+
if status.success?
|
2460
|
+
device_id = stdout.split("\n")[1].split("\t")[0]
|
2461
|
+
puts device_id
|
2462
|
+
puts 'adb -s ' + device_id + ' shell svc data disable'
|
2463
|
+
|
2464
|
+
stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
|
2465
|
+
if status2.success?
|
2466
|
+
sleep(3)
|
2467
|
+
puts 'adb -s ' + device_id + ' shell svc data enable'
|
2468
|
+
Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
|
2469
|
+
sleep(3)
|
2470
|
+
puts 'adb ok'
|
2471
|
+
sleep(8)
|
2472
|
+
|
2473
|
+
# IP 확인 및 재시도 (반복문 사용)
|
2474
|
+
retry_count = 0
|
2475
|
+
max_retries = 5
|
2476
|
+
current_ip = nil
|
2477
|
+
|
2478
|
+
# 무한 루프 방지
|
2479
|
+
while retry_count < max_retries
|
2480
|
+
begin
|
2481
|
+
http = HTTP.get('https://www.findip.kr/')
|
2482
|
+
noko = Nokogiri::HTML(http.to_s)
|
2483
|
+
new_ip = noko.xpath('/html/body/header/h2').text.strip
|
2484
|
+
|
2485
|
+
puts "Current IP: #{@my_ip}, New IP: #{new_ip}"
|
2486
|
+
|
2487
|
+
# IP가 변경되었으면 @my_ip를 갱신하고 종료
|
2488
|
+
if new_ip != @my_ip
|
2489
|
+
@my_ip = new_ip
|
2490
|
+
puts "IP 변경됨: #{@my_ip}"
|
2491
|
+
break
|
2492
|
+
else
|
2493
|
+
puts 'IP가 변경되지 않음. 재시도...'
|
2494
|
+
retry_count += 1
|
2495
|
+
sleep(3) # 3초 후 재시도
|
2496
|
+
end
|
2497
|
+
rescue => e
|
2498
|
+
retry_count += 1
|
2499
|
+
sleep(3) # 3초 후 재시도
|
2479
2500
|
end
|
2480
|
-
|
2501
|
+
|
2502
|
+
# 최대 재시도 횟수를 초과하면 예외 발생시키기
|
2503
|
+
if retry_count >= max_retries
|
2504
|
+
raise "최대 재시도 횟수 초과. IP 변경 실패."
|
2505
|
+
end
|
2506
|
+
end
|
2481
2507
|
else
|
2482
|
-
|
2508
|
+
puts 'Failed to disable data. Error: ' + stderr2
|
2483
2509
|
end
|
2510
|
+
else
|
2511
|
+
puts 'adb error, unable to get devices. Error: ' + stderr
|
2512
|
+
end
|
2484
2513
|
end
|
2485
|
-
|
2514
|
+
|
2486
2515
|
check_success = 1
|
2487
2516
|
@data['table'][index][-1] = 0
|
2488
2517
|
if @data['제목설정']['제목'].length == 0
|