cafe_basics 0.0.52 → 0.0.55
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 +66 -59
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bef77d64c5d9424096aeb2a289882168686f1351a7a41bd339a46cc329e508e
|
4
|
+
data.tar.gz: b87a323504efadad7576acfe05fd0077aba71f56e3e1dbb24435650464e83a4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e0108dd28d6bd5059f5733a8db76139cee66c78008f3c79389fdcf3645958d64f7dc6c362b0e8ab1b18c092bf952e955a0c0a5eb2fed3ddef3d2ea3df2c454b
|
7
|
+
data.tar.gz: 284119e1edb0ec1e9f960d0be66e4e4497592b99d97d969dd2a2cf1a303d16a2b5f989cbf5cb13a741bc03ef633701aa327ee447a4a7279171915387058376d5
|
data/lib/cafe_basics.rb
CHANGED
@@ -2144,77 +2144,53 @@ class Wordpress
|
|
2144
2144
|
puts table[10]
|
2145
2145
|
if table[7].to_i > table[10].to_i
|
2146
2146
|
if @data['포스트설정']['테더링'].checked?
|
2147
|
-
puts '
|
2148
|
-
|
2149
|
-
# ADB devices 확인
|
2147
|
+
puts 'Tethering IP change...'
|
2148
|
+
|
2150
2149
|
stdout, stderr, status = Open3.capture3('./adb devices')
|
2151
|
-
|
2150
|
+
|
2151
|
+
if status.success?
|
2152
2152
|
device_id = stdout.split("\n")[1].split("\t")[0]
|
2153
2153
|
puts device_id
|
2154
2154
|
|
2155
2155
|
# ADB 서버 초기화
|
2156
2156
|
puts 'adb kill-server'
|
2157
|
-
Open3.capture3('adb kill-server')
|
2158
|
-
sleep(
|
2157
|
+
Open3.capture3('./adb kill-server')
|
2158
|
+
sleep(3)
|
2159
2159
|
|
2160
2160
|
# 다시 ADB 서버 실행
|
2161
2161
|
puts 'adb start-server'
|
2162
|
-
Open3.capture3('adb start-server')
|
2163
|
-
sleep(
|
2162
|
+
Open3.capture3('./adb start-server')
|
2163
|
+
sleep(3)
|
2164
2164
|
|
2165
2165
|
# 데이터를 끄고 켜기
|
2166
2166
|
puts 'adb -s ' + device_id + ' shell svc data disable'
|
2167
|
-
stdout2, stderr2, status2 = Open3.capture3('./adb -s '
|
2168
|
-
|
2169
|
-
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2173
|
-
|
2174
|
-
|
2175
|
-
|
2176
|
-
|
2177
|
-
|
2178
|
-
|
2179
|
-
|
2180
|
-
|
2181
|
-
|
2182
|
-
|
2183
|
-
|
2184
|
-
|
2185
|
-
|
2186
|
-
noko = Nokogiri::HTML(http.to_s)
|
2187
|
-
new_ip = noko.xpath('/html/body/header/h2').text.strip
|
2188
|
-
|
2189
|
-
puts "Current IP: #{@my_ip}, New IP: #{new_ip}"
|
2190
|
-
|
2191
|
-
# IP가 변경되었으면 @my_ip를 갱신하고 종료
|
2192
|
-
if new_ip != @my_ip
|
2193
|
-
@my_ip = new_ip
|
2194
|
-
puts "IP 변경됨: #{@my_ip}"
|
2195
|
-
break
|
2196
|
-
else
|
2197
|
-
puts 'IP가 변경되지 않음. 재시도...'
|
2198
|
-
retry_count += 1
|
2199
|
-
sleep(3) # 3초 후 재시도
|
2200
|
-
end
|
2201
|
-
rescue => e
|
2202
|
-
retry_count += 1
|
2203
|
-
sleep(3) # 3초 후 재시도
|
2204
|
-
end
|
2205
|
-
|
2206
|
-
# 최대 재시도 횟수를 초과하면 예외 발생시키기
|
2207
|
-
if retry_count >= max_retries
|
2208
|
-
raise "최대 재시도 횟수 초과. IP 변경 실패."
|
2209
|
-
end
|
2167
|
+
stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
|
2168
|
+
sleep(3)
|
2169
|
+
puts 'adb -s ' + device_id + ' shell svc data enable'
|
2170
|
+
Open3.capture3('./adb -s '+device_id+' shell svc data enable')
|
2171
|
+
sleep(3)
|
2172
|
+
puts 'adb ok'
|
2173
|
+
sleep(8)
|
2174
|
+
|
2175
|
+
robot_ip = lambda do
|
2176
|
+
http = HTTP.get('https://www.findip.kr/')
|
2177
|
+
noko = Nokogiri::HTML(http.to_s)
|
2178
|
+
if noko.xpath('/html/body/header/h2').text != @my_ip
|
2179
|
+
@my_ip = noko.xpath('/html/body/header/h2').text
|
2180
|
+
puts "IP 변경됨[ #{@my_ip} ]"
|
2181
|
+
else
|
2182
|
+
puts @my_ip
|
2183
|
+
puts '제시도...'
|
2184
|
+
sleep(3)
|
2185
|
+
robot_ip[]
|
2210
2186
|
end
|
2211
|
-
|
2212
|
-
|
2213
|
-
|
2187
|
+
end
|
2188
|
+
robot_ip[]
|
2189
|
+
|
2214
2190
|
else
|
2215
|
-
|
2191
|
+
puts 'adb error pass'
|
2216
2192
|
end
|
2217
|
-
|
2193
|
+
end
|
2218
2194
|
|
2219
2195
|
|
2220
2196
|
check_success = 1
|
@@ -2926,11 +2902,42 @@ class Wordpress
|
|
2926
2902
|
end
|
2927
2903
|
end
|
2928
2904
|
|
2905
|
+
#if @data['포스트설정']['지도로변경'].checked?
|
2906
|
+
# @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
|
2907
|
+
# content = content.split(i.force_encoding('utf-8')).join("<koreamap>"+@data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')+"</koreamap>")
|
2908
|
+
# end
|
2909
|
+
#end
|
2929
2910
|
if @data['포스트설정']['지도로변경'].checked?
|
2930
|
-
|
2931
|
-
|
2911
|
+
# 지도 주소와 사용자 설정 단어들을 가져옵니다.
|
2912
|
+
map_address = @data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8')
|
2913
|
+
|
2914
|
+
# 여러 단어로 설정된 '지도로변경단어'를 분리하여 배열로 저장
|
2915
|
+
change_words = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',')
|
2916
|
+
|
2917
|
+
# content를 각 줄로 분할
|
2918
|
+
content_lines = content.split("\n")
|
2919
|
+
|
2920
|
+
content_lines.each_with_index do |line, index|
|
2921
|
+
# 각 단어에 대해 처리
|
2922
|
+
change_words.each do |change_word|
|
2923
|
+
# 'change_word'가 포함된 줄에 대해서만 처리
|
2924
|
+
if line.include?(change_word)
|
2925
|
+
# 설정된 단어 뒤에 괄호가 있는지 확인
|
2926
|
+
if line.include?("[") && line.include?("]")
|
2927
|
+
# 괄호 안의 주소를 찾아서 그 주소는 그대로 두고, 지도로 변경된 주소로 교체
|
2928
|
+
address_in_brackets = line.match(/\[(.*?)\]/)[1] # 괄호 안의 주소를 추출
|
2929
|
+
content_lines[index] = "<koreamap>#{address_in_brackets}</koreamap>"
|
2930
|
+
else
|
2931
|
+
# 괄호가 없다면 @data['포스트설정']['지도주소']를 추가
|
2932
|
+
content_lines[index] = "<koreamap>#{map_address}</koreamap>"
|
2933
|
+
end
|
2934
|
+
end
|
2935
|
+
end
|
2932
2936
|
end
|
2933
|
-
|
2937
|
+
|
2938
|
+
# 다시 content로 합치기
|
2939
|
+
content = content_lines.join("\n")
|
2940
|
+
end
|
2934
2941
|
|
2935
2942
|
if @data['포스트설정']['인용구변경'].checked?
|
2936
2943
|
if @data['포스트설정']['인용구문구설정'].checked?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_basics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.55
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|