cafe_buy 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_buy.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: 51a9842acd53cadf2c0ff0a0cdf96904040fb582632bfb58bb2f19ecb2e900d3
|
4
|
+
data.tar.gz: dd9e6b204083a1d7c6e1090bda0b69b8a93f7aaf54f59f22e9f0f0cb02afac9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3044cfd3e085406d218dca1d493d10c6b0467078b8d66a1af08096ab606959927a39aa8dc9ff5a50555cf174b76c31a7475b1fc52542729cfc99b5dacf87b80
|
7
|
+
data.tar.gz: e214eca7d9194384430b466b89ab831c0a44e53185306fbfa7b6f6ed7422ef30a202392179506ec1a78f5f030e13a824fd75d3995a5895d524ed9308f38825cd
|
data/lib/cafe_buy.rb
CHANGED
@@ -2475,77 +2475,53 @@ class Wordpress
|
|
2475
2475
|
puts table[10]
|
2476
2476
|
if table[7].to_i > table[10].to_i
|
2477
2477
|
if @data['포스트설정']['테더링'].checked?
|
2478
|
-
puts '
|
2479
|
-
|
2480
|
-
# ADB devices 확인
|
2478
|
+
puts 'Tethering IP change...'
|
2479
|
+
|
2481
2480
|
stdout, stderr, status = Open3.capture3('./adb devices')
|
2482
|
-
|
2481
|
+
|
2482
|
+
if status.success?
|
2483
2483
|
device_id = stdout.split("\n")[1].split("\t")[0]
|
2484
2484
|
puts device_id
|
2485
2485
|
|
2486
2486
|
# ADB 서버 초기화
|
2487
2487
|
puts 'adb kill-server'
|
2488
|
-
Open3.capture3('adb kill-server')
|
2489
|
-
sleep(
|
2488
|
+
Open3.capture3('./adb kill-server')
|
2489
|
+
sleep(3)
|
2490
2490
|
|
2491
2491
|
# 다시 ADB 서버 실행
|
2492
2492
|
puts 'adb start-server'
|
2493
|
-
Open3.capture3('adb start-server')
|
2494
|
-
sleep(
|
2493
|
+
Open3.capture3('./adb start-server')
|
2494
|
+
sleep(3)
|
2495
2495
|
|
2496
2496
|
# 데이터를 끄고 켜기
|
2497
2497
|
puts 'adb -s ' + device_id + ' shell svc data disable'
|
2498
|
-
stdout2, stderr2, status2 = Open3.capture3('./adb -s '
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2502
|
-
|
2503
|
-
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
|
2517
|
-
noko = Nokogiri::HTML(http.to_s)
|
2518
|
-
new_ip = noko.xpath('/html/body/header/h2').text.strip
|
2519
|
-
|
2520
|
-
puts "Current IP: #{@my_ip}, New IP: #{new_ip}"
|
2521
|
-
|
2522
|
-
# IP가 변경되었으면 @my_ip를 갱신하고 종료
|
2523
|
-
if new_ip != @my_ip
|
2524
|
-
@my_ip = new_ip
|
2525
|
-
puts "IP 변경됨: #{@my_ip}"
|
2526
|
-
break
|
2527
|
-
else
|
2528
|
-
puts 'IP가 변경되지 않음. 재시도...'
|
2529
|
-
retry_count += 1
|
2530
|
-
sleep(3) # 3초 후 재시도
|
2531
|
-
end
|
2532
|
-
rescue => e
|
2533
|
-
retry_count += 1
|
2534
|
-
sleep(3) # 3초 후 재시도
|
2535
|
-
end
|
2536
|
-
|
2537
|
-
# 최대 재시도 횟수를 초과하면 예외 발생시키기
|
2538
|
-
if retry_count >= max_retries
|
2539
|
-
raise "최대 재시도 횟수 초과. IP 변경 실패."
|
2540
|
-
end
|
2498
|
+
stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
|
2499
|
+
sleep(3)
|
2500
|
+
puts 'adb -s ' + device_id + ' shell svc data enable'
|
2501
|
+
Open3.capture3('./adb -s '+device_id+' shell svc data enable')
|
2502
|
+
sleep(3)
|
2503
|
+
puts 'adb ok'
|
2504
|
+
sleep(8)
|
2505
|
+
|
2506
|
+
robot_ip = lambda do
|
2507
|
+
http = HTTP.get('https://www.findip.kr/')
|
2508
|
+
noko = Nokogiri::HTML(http.to_s)
|
2509
|
+
if noko.xpath('/html/body/header/h2').text != @my_ip
|
2510
|
+
@my_ip = noko.xpath('/html/body/header/h2').text
|
2511
|
+
puts "IP 변경됨[ #{@my_ip} ]"
|
2512
|
+
else
|
2513
|
+
puts @my_ip
|
2514
|
+
puts '제시도...'
|
2515
|
+
sleep(3)
|
2516
|
+
robot_ip[]
|
2541
2517
|
end
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2518
|
+
end
|
2519
|
+
robot_ip[]
|
2520
|
+
|
2545
2521
|
else
|
2546
|
-
|
2522
|
+
puts 'adb error pass'
|
2547
2523
|
end
|
2548
|
-
|
2524
|
+
end
|
2549
2525
|
|
2550
2526
|
check_success = 1
|
2551
2527
|
@data['table'][index][-1] = 0
|
@@ -3251,11 +3227,42 @@ class Wordpress
|
|
3251
3227
|
end
|
3252
3228
|
end
|
3253
3229
|
|
3230
|
+
#if @data['포스트설정']['지도로변경'].checked?
|
3231
|
+
# @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
|
3232
|
+
# content = content.split(i.force_encoding('utf-8')).join("<koreamap>"+@data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')+"</koreamap>")
|
3233
|
+
# end
|
3234
|
+
#end
|
3254
3235
|
if @data['포스트설정']['지도로변경'].checked?
|
3255
|
-
|
3256
|
-
|
3236
|
+
# 지도 주소와 사용자 설정 단어들을 가져옵니다.
|
3237
|
+
map_address = @data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8')
|
3238
|
+
|
3239
|
+
# 여러 단어로 설정된 '지도로변경단어'를 분리하여 배열로 저장
|
3240
|
+
change_words = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',')
|
3241
|
+
|
3242
|
+
# content를 각 줄로 분할
|
3243
|
+
content_lines = content.split("\n")
|
3244
|
+
|
3245
|
+
content_lines.each_with_index do |line, index|
|
3246
|
+
# 각 단어에 대해 처리
|
3247
|
+
change_words.each do |change_word|
|
3248
|
+
# 'change_word'가 포함된 줄에 대해서만 처리
|
3249
|
+
if line.include?(change_word)
|
3250
|
+
# 설정된 단어 뒤에 괄호가 있는지 확인
|
3251
|
+
if line.include?("[") && line.include?("]")
|
3252
|
+
# 괄호 안의 주소를 찾아서 그 주소는 그대로 두고, 지도로 변경된 주소로 교체
|
3253
|
+
address_in_brackets = line.match(/\[(.*?)\]/)[1] # 괄호 안의 주소를 추출
|
3254
|
+
content_lines[index] = "<koreamap>#{address_in_brackets}</koreamap>"
|
3255
|
+
else
|
3256
|
+
# 괄호가 없다면 @data['포스트설정']['지도주소']를 추가
|
3257
|
+
content_lines[index] = "<koreamap>#{map_address}</koreamap>"
|
3258
|
+
end
|
3259
|
+
end
|
3260
|
+
end
|
3257
3261
|
end
|
3258
|
-
|
3262
|
+
|
3263
|
+
# 다시 content로 합치기
|
3264
|
+
content = content_lines.join("\n")
|
3265
|
+
end
|
3259
3266
|
|
3260
3267
|
if @data['포스트설정']['인용구변경'].checked?
|
3261
3268
|
if @data['포스트설정']['인용구문구설정'].checked?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_buy
|
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
|