cafe_basics 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.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: c0d42592e75b24fb39c3052fc0bd7ff55cb1af18d95dd46a7acc0228decbee2b
|
4
|
+
data.tar.gz: 1365b7e16a2225dd5ceeda0ec6298eb4497fbc26a039c4bb09d6e2a13739ce69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96f4f2074dbbbf3ff2000b7938352bbd104e4b8ca008ddb6ded5fdea24694e52a84e47e1eb1c8f8ed005caaacb92c1d9c3800286f5eee0242ea986690d1bed32
|
7
|
+
data.tar.gz: 7a46539da88ca48ae1345d141e08084736cb037b940646948bfe9646d87fcdddf146760cd9f8ff994f1df1a16a189c3e384433bbc769424165d4e4c3c5414658
|
data/lib/cafe_basics.rb
CHANGED
@@ -2122,65 +2122,77 @@ class Wordpress
|
|
2122
2122
|
puts table[10]
|
2123
2123
|
if table[7].to_i > table[10].to_i
|
2124
2124
|
if @data['포스트설정']['테더링'].checked?
|
2125
|
-
|
2126
|
-
|
2127
|
-
|
2128
|
-
|
2129
|
-
|
2130
|
-
|
2131
|
-
|
2132
|
-
|
2133
|
-
|
2134
|
-
|
2135
|
-
|
2136
|
-
sleep(
|
2137
|
-
|
2138
|
-
|
2139
|
-
|
2140
|
-
|
2141
|
-
sleep(
|
2142
|
-
|
2143
|
-
#
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2158
|
-
|
2159
|
-
|
2160
|
-
|
2161
|
-
|
2162
|
-
|
2163
|
-
|
2125
|
+
puts 'tethering ip change...'
|
2126
|
+
|
2127
|
+
# ADB devices 확인
|
2128
|
+
stdout, stderr, status = Open3.capture3('./adb devices')
|
2129
|
+
if status.success?
|
2130
|
+
device_id = stdout.split("\n")[1].split("\t")[0]
|
2131
|
+
puts device_id
|
2132
|
+
|
2133
|
+
# ADB 서버 초기화
|
2134
|
+
puts 'adb kill-server'
|
2135
|
+
Open3.capture3('adb kill-server')
|
2136
|
+
sleep(2)
|
2137
|
+
|
2138
|
+
# 다시 ADB 서버 실행
|
2139
|
+
puts 'adb start-server'
|
2140
|
+
Open3.capture3('adb start-server')
|
2141
|
+
sleep(2)
|
2142
|
+
|
2143
|
+
# 데이터를 끄고 켜기
|
2144
|
+
puts 'adb -s ' + device_id + ' shell svc data disable'
|
2145
|
+
stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
|
2146
|
+
|
2147
|
+
if status2.success?
|
2148
|
+
sleep(3)
|
2149
|
+
puts 'adb -s ' + device_id + ' shell svc data enable'
|
2150
|
+
Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
|
2151
|
+
sleep(3)
|
2152
|
+
puts 'adb ok'
|
2153
|
+
sleep(8)
|
2154
|
+
|
2155
|
+
# IP 확인 및 재시도 (반복문 사용)
|
2156
|
+
retry_count = 0
|
2157
|
+
max_retries = 5
|
2158
|
+
current_ip = nil
|
2159
|
+
|
2160
|
+
# 무한 루프 방지
|
2161
|
+
while retry_count < max_retries
|
2162
|
+
begin
|
2163
|
+
http = HTTP.get('https://www.findip.kr/')
|
2164
|
+
noko = Nokogiri::HTML(http.to_s)
|
2165
|
+
new_ip = noko.xpath('/html/body/header/h2').text.strip
|
2166
|
+
|
2167
|
+
puts "Current IP: #{@my_ip}, New IP: #{new_ip}"
|
2168
|
+
|
2169
|
+
# IP가 변경되었으면 @my_ip를 갱신하고 종료
|
2170
|
+
if new_ip != @my_ip
|
2171
|
+
@my_ip = new_ip
|
2172
|
+
puts "IP 변경됨: #{@my_ip}"
|
2173
|
+
break
|
2174
|
+
else
|
2175
|
+
puts 'IP가 변경되지 않음. 재시도...'
|
2176
|
+
retry_count += 1
|
2177
|
+
sleep(3) # 3초 후 재시도
|
2178
|
+
end
|
2179
|
+
rescue => e
|
2164
2180
|
retry_count += 1
|
2165
2181
|
sleep(3) # 3초 후 재시도
|
2166
2182
|
end
|
2167
|
-
|
2168
|
-
|
2169
|
-
|
2170
|
-
|
2171
|
-
|
2172
|
-
# 최대 재시도 횟수를 초과하면 예외 발생시키기
|
2173
|
-
if retry_count >= max_retries
|
2174
|
-
raise "최대 재시도 횟수 초과. IP 변경 실패."
|
2183
|
+
|
2184
|
+
# 최대 재시도 횟수를 초과하면 예외 발생시키기
|
2185
|
+
if retry_count >= max_retries
|
2186
|
+
raise "최대 재시도 횟수 초과. IP 변경 실패."
|
2187
|
+
end
|
2175
2188
|
end
|
2189
|
+
else
|
2190
|
+
puts 'Failed to disable data. Error: ' + stderr2
|
2176
2191
|
end
|
2177
2192
|
else
|
2178
|
-
puts '
|
2193
|
+
puts 'adb error, unable to get devices. Error: ' + stderr
|
2179
2194
|
end
|
2180
|
-
else
|
2181
|
-
puts 'adb error, unable to get devices. Error: ' + stderr
|
2182
2195
|
end
|
2183
|
-
end
|
2184
2196
|
|
2185
2197
|
|
2186
2198
|
check_success = 1
|