posting_duo 3.111.011 → 3.111.013

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/posting_duo.rb +131 -244
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4cd17d412de36d2aec062690f7a3a76d73ac79cb0fcdb484bda70574eedf9fe
4
- data.tar.gz: 334f73019b768690f1f69885eeda80dade1bf1357b39e09fa000d1957a108145
3
+ metadata.gz: a5d822c7044b56fc799bab10790b7d66789cdfbca78ff77237797066516f3f23
4
+ data.tar.gz: a75b34e8c12d9c57f660b870f771794d92560afed23392c84f61b34d74d23529
5
5
  SHA512:
6
- metadata.gz: 93ca8a79e4033389b0978d78ca9c8a19d73398d039637ff899a5c286695f959f06d9050b9f0efdadda741b54a7aef756142fddb4e054abc1367f4e819f362053
7
- data.tar.gz: a667ed90db900429bc320e084e0714a2e582188353379451ee0f07f0a2b15b4b30dcef6392cfc63bea2d523d17581a07402f8198f523f11f85acef8e40716ec8
6
+ metadata.gz: c37f29d2f33ab200f0c18df1b798b393532fff20d61597f021ae915587438cc7f3ab7e9d44b7912210288c3b166e2e4092419d75527d7d7341655cb141e681b4
7
+ data.tar.gz: ba5e47f6e5edb8613ca65925533a9c23ae22f316243b1c0b3d572c044c02f4494a41a7b27609d86acfdda2ddc74aeebc4b96ab5b398497982827011a908ae6b6
data/lib/posting_duo.rb CHANGED
@@ -6897,7 +6897,13 @@ begin
6897
6897
  sleep(1)
6898
6898
  puts '-[√] 닉네임 27코드 타겟.......'.yellow
6899
6899
  rescue
6900
-
6900
+ begin
6901
+ @driver.find_element(xpath: '//input[@type="text" and @name="member_display"]').send_keys(user_id)
6902
+ sleep(1)
6903
+ puts '-[√] 닉네임 28코드 타겟.......'.yellow
6904
+ rescue
6905
+
6906
+ end
6901
6907
  end
6902
6908
  end
6903
6909
  end
@@ -8356,34 +8362,44 @@ end
8356
8362
  rescue
8357
8363
  begin
8358
8364
  @driver.switch_to.default_content
8359
- if target_element
8360
- # 3. 제목 요소 바로 아래에 체크박스 HTML 삽입
8361
- checkbox_html = <<~HTML
8362
- <div class="custom-control custom-checkbox custom-control-inline">
8363
- <input type="checkbox" name="html" value="html2" id="html" onclick="html_auto_br(this);" class="custom-control-input">
8364
- <label class="custom-control-label" for="html"><span>HTML</span></label>
8365
- </div>
8366
- HTML
8367
- @driver.execute_script("arguments[0].insertAdjacentHTML('afterend', arguments[1]);", target_element, checkbox_html)
8368
- puts '체크박스 HTML 강제 적용.......'.green
8369
- sleep(1)
8370
-
8371
- # 4. 삽입한 체크박스 스크롤하여 화면 중앙으로 이동
8372
- html_checkbox = @driver.find_element(:xpath, '//*[@type="checkbox" and @name="html"]')
8373
- @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_checkbox)
8374
- sleep(1)
8375
-
8376
- # 5. HTML 토글 버튼 클릭
8377
- @driver.find_element(:xpath, '//*[@type="checkbox" and @name="html"]').click
8378
- puts '-[√] 임의 추가 HTML 코드 01 code.......'.yellow
8365
+ html_bb = @driver.find_element(xpath: '//input[@type="checkbox" and @name="chkhtml"]')
8366
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
8367
+ sleep(1)
8368
+ html_bb = @driver.find_element(xpath: '//input[@type="checkbox" and @name="chkhtml"]').click
8369
+ puts '-[√] HTML 코드 38 code.......'.yellow
8379
8370
  sleep(1)
8380
-
8381
- else
8382
- puts "타겟 제목 요소가 없어서 체크박스 삽입 불가".red
8383
- end
8384
8371
  rescue
8385
-
8386
- end
8372
+ begin
8373
+ @driver.switch_to.default_content
8374
+ if target_element
8375
+ # 3. 제목 요소 바로 아래에 체크박스 HTML 삽입
8376
+ checkbox_html = <<~HTML
8377
+ <div class="custom-control custom-checkbox custom-control-inline">
8378
+ <input type="checkbox" name="html" value="html2" id="html" onclick="html_auto_br(this);" class="custom-control-input">
8379
+ <label class="custom-control-label" for="html"><span>HTML</span></label>
8380
+ </div>
8381
+ HTML
8382
+ @driver.execute_script("arguments[0].insertAdjacentHTML('afterend', arguments[1]);", target_element, checkbox_html)
8383
+ puts '체크박스 HTML 강제 적용.......'.green
8384
+ sleep(1)
8385
+
8386
+ # 4. 삽입한 체크박스 스크롤하여 화면 중앙으로 이동
8387
+ html_checkbox = @driver.find_element(:xpath, '//*[@type="checkbox" and @name="html"]')
8388
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_checkbox)
8389
+ sleep(1)
8390
+
8391
+ # 5. HTML 토글 버튼 클릭
8392
+ @driver.find_element(:xpath, '//*[@type="checkbox" and @name="html"]').click
8393
+ puts '-[√] 임의 추가 HTML 코드 01 code.......'.yellow
8394
+ sleep(1)
8395
+
8396
+ else
8397
+ puts "타겟 제목 요소가 없어서 체크박스 삽입 불가".red
8398
+ end
8399
+ rescue
8400
+
8401
+ end
8402
+ end
8387
8403
  end
8388
8404
  end
8389
8405
  end
@@ -12408,6 +12424,26 @@ ss_button = @driver.find_element(xpath: '//button[@type="submit" and contains(@c
12408
12424
  puts '-[√] 등록을 53번 코드로 시도하였습니다.......'.magenta
12409
12425
  sleep(1)
12410
12426
 
12427
+ rescue
12428
+ begin
12429
+ ss_button = @driver.find_element(xpath: '//img[contains(@src, "btn_write.gif")]')
12430
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
12431
+ sleep(1)
12432
+
12433
+ ss_button = @driver.find_element(xpath: '//img[contains(@src, "btn_write.gif")]').click
12434
+ puts '-[√] 등록을 54번 코드로 시도하였습니다.......'.magenta
12435
+ sleep(1)
12436
+ '//button[@type="submit" and contains(@class, "kboard-default-button-small") and contains(text(), "저장하기")]'
12437
+ rescue
12438
+ begin
12439
+ ss_button = @driver.find_element(xpath: '//button[@type="submit" and contains(@class, "kboard-default-button-small") and contains(text(), "저장하기")]')
12440
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
12441
+ sleep(1)
12442
+
12443
+ ss_button = @driver.find_element(xpath: '//button[@type="submit" and contains(@class, "kboard-default-button-small") and contains(text(), "저장하기")]').click
12444
+ puts '-[√] 등록을 55번 코드로 시도하였습니다.......'.magenta
12445
+ sleep(1)
12446
+
12411
12447
  rescue
12412
12448
  ########─────────────────────────────▼▼▼▼▼▼▼ 등록버튼 2차 시도 ▼▼▼▼▼▼▼──────────────────────────────#######
12413
12449
  begin
@@ -12619,6 +12655,8 @@ end
12619
12655
  end
12620
12656
  end
12621
12657
  end
12658
+ end
12659
+ end
12622
12660
  end
12623
12661
  ########─────────────────────────────▲▲▲▲▲▲▲ 등록버튼 2차 시도 ▲▲▲▲▲▲▲──────────────────────────────#######
12624
12662
  end
@@ -13353,6 +13391,7 @@ class Wordpress
13353
13391
  end
13354
13392
 
13355
13393
 
13394
+
13356
13395
  def color_image
13357
13396
  color = File.open('./color.ini', 'r', :encoding => 'utf-8').read().split("\n")
13358
13397
  image = Magick::Image.new(740, 740) { |k| k.background_color = color.sample }
@@ -13361,187 +13400,79 @@ class Wordpress
13361
13400
 
13362
13401
  def save_image
13363
13402
  if @data['이미지설정']['이미지'].length == 0
13364
- return
13365
- end
13366
-
13367
- if @data['이미지설정']['순서사용'].checked?
13368
- image_path = @data['이미지설정']['이미지'][@image_counter][2]
13369
- @image_counter += 1
13370
- if @image_counter > @data['이미지설정']['이미지'].length - 1
13371
- @image_counter = 0
13372
- end
13403
+
13373
13404
  else
13374
- # 초기화가 안됐거나 다 썼으면 새롭게 섞는다
13375
- @shuffled_images ||= []
13376
- if @shuffled_images.empty?
13377
- @shuffled_images = @data['이미지설정']['이미지'].shuffle
13405
+ if @data['이미지설정']['순서사용'].checked?
13406
+ image_path = @data['이미지설정']['이미지'][@image_counter][2]
13407
+ @image_counter += 1
13408
+ if @image_counter > @data['이미지설정']['이미지'].length-1
13409
+ @image_counter = 0
13410
+ end
13411
+ else
13412
+ image_path = @data['이미지설정']['이미지'].sample[2]
13378
13413
  end
13379
-
13380
- image_path = @shuffled_images.shift[2]
13414
+ img = Magick::Image.read(image_path).first
13415
+ img.write('./image/memory.png')
13381
13416
  end
13382
-
13383
- img = Magick::Image.read(image_path).first
13384
- img.write('./image/memory.png')
13385
13417
  end
13386
13418
 
13387
13419
  def change_image_size(w)
13388
13420
  img = Magick::Image.read('./image/memory.png').first
13389
13421
  width = img.columns
13390
13422
  height = img.rows
13391
-
13392
- # '원본' 선택된 경우, 리사이징을 하지 않고 원본 이미지를 그대로 반환
13393
- if w == 'original'
13394
- return img # 원본 이미지 그대로 반환
13395
- else
13396
- begin
13397
- if @data['image_type'][0].checked? or @data['image_type'][2].checked?
13398
- # 비율을 맞추어 리사이징
13399
- img.resize!(w, w * (height.to_f / width.to_f))
13400
- else
13401
- # 정사각형으로 리사이징
13402
- img.resize!(w, w)
13403
- end
13404
- rescue
13405
- img.resize!(w, w) # 예외 처리 시에도 리사이징
13423
+ begin
13424
+ if @data['image_type'][0].checked? or @data['image_type'][2].checked?
13425
+ img.resize!(w, w*(height.to_f/width.to_f))
13426
+ else
13427
+ img.resize!(w, w)
13406
13428
  end
13429
+ rescue
13430
+ img.resize!(w, w)
13407
13431
  end
13408
-
13409
- # 리사이징된 이미지 저장
13410
13432
  img.write('./image/memory.png')
13411
13433
  end
13412
13434
 
13413
- def wrap_text_to_fit(draw, text, max_width, max_height, font_path, initial_size)
13414
- size = initial_size
13415
- draw.font = font_path
13416
-
13417
- loop do
13418
- draw.pointsize = size
13419
- words = text.chars # 글자 단위로 자름 (한국어 기준)
13420
- lines = []
13421
- line = ""
13422
-
13423
- words.each do |char|
13424
- test_line = line + char
13425
- metrics = draw.get_type_metrics(test_line)
13426
- if metrics.width > max_width
13427
- lines << line
13428
- line = char
13429
- else
13430
- line = test_line
13431
- end
13435
+ def image_text(text1, text2)
13436
+ begin
13437
+ color = File.open('./color.ini', 'r', :encoding => 'utf-8').read().split("\n")
13438
+ font = Dir.entries('./fonts')
13439
+ img = Magick::Image.read('./image/memory.png').first
13440
+ text = Magick::Draw.new
13441
+ color2 = color.sample
13442
+ font2 = './fonts/'+font.sample
13443
+ message = text1.to_s+"\n"+text2.to_s
13444
+ begin
13445
+ size = rand(@data['이미지설정']['이미지글자1크기1'].text.to_i..@data['이미지설정']['이미지글자1크기2'].text.to_i)
13446
+ rescue
13447
+ size = 30
13432
13448
  end
13433
- lines << line unless line.empty?
13434
-
13435
- line_height = draw.get_type_metrics("가").height
13436
- total_height = line_height * lines.size
13437
-
13438
- # 세로 초과 안 하면 성공
13439
- if total_height <= max_height || size <= 10
13440
- return [lines.join("\n"), size]
13441
- else
13442
- size -= 2
13449
+ if @data['이미지설정']['글자그림자'].checked?
13450
+ img.annotate(text, 0,0, +3,+3, message) do
13451
+ text.gravity = Magick::CenterGravity
13452
+ text.pointsize = size
13453
+ text.fill = '#000000'
13454
+ text.font = font2
13455
+ end
13443
13456
  end
13444
- end
13445
- end
13446
-
13447
-
13448
- def image_text(text1, text2)
13449
- begin
13450
- color = File.open('./color.ini', 'r', encoding: 'utf-8').read.split("\n").map(&:strip).reject(&:empty?)
13451
- font_files = Dir.entries('./fonts').select { |f| f.downcase.end_with?('.ttf') }
13452
- font2 = './fonts/' + font_files.sample
13453
-
13454
- # 랜덤 글자색 선택
13455
- color2 = color.sample
13456
13457
 
13457
- # 헬퍼 함수: 색상 문자열 '#RRGGBB' -> [R,G,B] 배열로 변환
13458
- def hex_to_rgb(hex)
13459
- hex = hex.delete('#')
13460
- [hex[0..1], hex[2..3], hex[4..5]].map { |c| c.to_i(16) }
13461
- end
13462
-
13463
- # 헬퍼 함수: 두 RGB 색상의 차이 계산 (간단한 유클리드 거리)
13464
- def color_distance(c1, c2)
13465
- Math.sqrt(
13466
- (c1[0] - c2[0])**2 +
13467
- (c1[1] - c2[1])**2 +
13468
- (c1[2] - c2[2])**2
13469
- )
13470
- end
13471
-
13472
- # 대비가 충분히 되는 테두리 색상 선택
13473
- max_attempts = 10
13474
- stroke_color = nil
13475
- base_rgb = hex_to_rgb(color2)
13476
-
13477
- max_attempts.times do
13478
- candidate = color.sample
13479
- candidate_rgb = hex_to_rgb(candidate)
13480
- dist = color_distance(base_rgb, candidate_rgb)
13481
-
13482
- # 거리(차이) 임계값 100 (0~441 범위) — 필요시 조절 가능
13483
- if dist > 100
13484
- stroke_color = candidate
13485
- break
13486
- end
13487
- end
13488
- stroke_color ||= '#000000' # 만약 충분히 다른 색 없으면 검정색 기본값
13489
-
13490
- img = Magick::Image.read('./image/memory.png').first
13491
- draw = Magick::Draw.new
13492
-
13493
- raw_message = "#{text1}\n#{text2}".strip
13494
- max_width = img.columns * 0.85
13495
- max_height = img.rows * 0.6
13458
+ img.annotate(text, 0,0,0,0, message) do
13459
+ text.gravity = Magick::CenterGravity
13460
+ text.pointsize = size
13461
+ if @data['이미지설정']['글자테두리'].checked?
13462
+ text.stroke_width = 2
13463
+ text.stroke = '#000000'
13464
+ end
13465
+ text.fill = color2
13466
+ text.font = font2
13467
+ end
13496
13468
 
13497
- begin
13498
- size = rand(@data['이미지설정']['이미지글자1크기1'].text.to_i..@data['이미지설정']['이미지글자1크기2'].text.to_i)
13469
+ img.write('./image/memory.png')
13499
13470
  rescue
13500
- size = 30
13501
- end
13502
-
13503
- wrapped_message, adjusted_size = wrap_text_to_fit(draw, raw_message, max_width, max_height, font2, size)
13504
-
13505
- if @data['이미지설정']['글자그림자'].checked?
13506
- img.annotate(draw, 0, 0, 2, 2, wrapped_message) do
13507
- draw.gravity = Magick::CenterGravity
13508
- draw.pointsize = adjusted_size
13509
- draw.fill = '#000000'
13510
- draw.font = font2
13511
- end
13512
- end
13513
-
13514
- if @data['이미지설정']['글자테두리'].checked?
13515
- draw_stroke = Magick::Draw.new
13516
- img.annotate(draw_stroke, 0, 0, 0, 0, wrapped_message) do
13517
- draw_stroke.gravity = Magick::CenterGravity
13518
- draw_stroke.pointsize = adjusted_size
13519
- draw_stroke.fill = 'none'
13520
- draw_stroke.stroke = stroke_color
13521
- draw_stroke.stroke_width = rand(5..10)
13522
- draw_stroke.font = font2
13523
- end
13524
- end
13525
-
13526
- draw2 = Magick::Draw.new
13527
- img.annotate(draw2, 0, 0, 0, 0, wrapped_message) do
13528
- draw2.gravity = Magick::CenterGravity
13529
- draw2.pointsize = adjusted_size
13530
- draw2.fill = color2
13531
- draw2.stroke = 'none'
13532
- draw2.font = font2
13471
+ puts '이미지 폰트 불러오기 오류 재시도...'
13472
+ sleep(3)
13473
+ retry
13533
13474
  end
13534
-
13535
- img.write('./image/memory.png')
13536
-
13537
- rescue => e
13538
- puts "이미지 폰트 불러오기 오류 재시도... (#{e.message})"
13539
- sleep(3)
13540
- retry
13541
13475
  end
13542
- end
13543
-
13544
-
13545
13476
 
13546
13477
  def border()
13547
13478
  color = File.open('./color.ini', 'r',:encoding => 'utf-8').read().split("\n")
@@ -13568,69 +13499,40 @@ class Wordpress
13568
13499
  else
13569
13500
  auto_image()
13570
13501
  end
13571
-
13572
- # '원본'을 포함한 이미지 크기 옵션 추가
13573
- image_size = [480, 740, 650, 550, 480, 'original']
13502
+
13503
+ image_size = [480,740,650,550,480]
13574
13504
  size = 0
13575
-
13576
- for n in 0..5 # 0부터 5까지 반복, '원본' 옵션까지 포함
13505
+ for n in 0..4
13577
13506
  if @data['image_size'][n].checked?
13578
- if n == 5 # '원본'이 선택되었을 경우
13579
- size = 'original'
13580
- elsif n == 0
13581
- size = image_size.sample # 랜덤 선택
13507
+ if n == 0
13508
+ size = image_size.sample
13582
13509
  else
13583
13510
  size = image_size[n]
13584
13511
  end
13585
13512
  end
13586
13513
  end
13587
-
13588
- # '원본'이 선택되지 않았다면 기본 값 설정
13589
13514
  if size == 0
13590
13515
  size = 480
13591
13516
  end
13592
-
13593
- change_image_size(size) # 크기 변경 함수 호출
13594
13517
 
13518
+ change_image_size(size)
13595
13519
 
13596
13520
  if @data['이미지설정']['필터사용'].checked?
13597
13521
  image_filter()
13598
13522
  end
13599
13523
 
13524
+ insert_image_text1 = ''
13525
+ insert_image_text2 = ''
13600
13526
  if @data['이미지설정']['글자삽입1'].checked?
13601
- if @data['이미지설정']['이미지글자1'].length == 0
13602
- image_text_path1 = ''
13603
- else
13604
- if @data['이미지설정']['글자랜덤'].checked?
13605
- image_text_path1 = @data['이미지설정']['이미지글자1'].sample
13606
- else
13607
- image_text_path1 = @data['이미지설정']['이미지글자1'][@image_text_soon1]
13608
- @image_text_soon1 += 1
13609
- if @image_text_soon1 > @data['이미지설정']['이미지글자1'].length - 1
13610
- @image_text_soon1 = 0
13611
- end
13612
- end
13613
- end
13527
+ insert_image_text1 = @data['이미지설정']['이미지글자1'].sample
13614
13528
  end
13615
13529
 
13616
13530
  if @data['이미지설정']['글자삽입2'].checked?
13617
- if @data['이미지설정']['이미지글자2'].length == 0
13618
- image_text_path2 = ''
13619
- else
13620
- if @data['이미지설정']['글자랜덤'].checked?
13621
- image_text_path2 = @data['이미지설정']['이미지글자2'].sample
13622
- else
13623
- image_text_path2 = @data['이미지설정']['이미지글자2'][@image_text_soon2]
13624
- @image_text_soon2 += 1
13625
- if @image_text_soon2 > @data['이미지설정']['이미지글자2'].length - 1
13626
- @image_text_soon2 = 0
13627
- end
13628
- end
13629
- end
13531
+ insert_image_text2 = @data['이미지설정']['이미지글자2'].sample
13630
13532
  end
13631
-
13533
+
13632
13534
  if @data['이미지설정']['글자삽입1'].checked? or @data['이미지설정']['글자삽입2'].checked?
13633
- image_text(image_text_path1, image_text_path2)
13535
+ image_text(insert_image_text1, insert_image_text2)
13634
13536
  end
13635
13537
 
13636
13538
  if @data['이미지설정']['테두리사용'].checked?
@@ -15498,7 +15400,6 @@ class Wordpress
15498
15400
  @data['image_size'][2].checked = false
15499
15401
  @data['image_size'][3].checked = false
15500
15402
  @data['image_size'][4].checked = false
15501
- @data['image_size'][5].checked = false
15502
15403
  end
15503
15404
  }
15504
15405
  }
@@ -15509,7 +15410,6 @@ class Wordpress
15509
15410
  @data['image_size'][2].checked = false
15510
15411
  @data['image_size'][3].checked = false
15511
15412
  @data['image_size'][4].checked = false
15512
- @data['image_size'][5].checked = false
15513
15413
  end
15514
15414
  }
15515
15415
  }
@@ -15520,7 +15420,6 @@ class Wordpress
15520
15420
  @data['image_size'][0].checked = false
15521
15421
  @data['image_size'][3].checked = false
15522
15422
  @data['image_size'][4].checked = false
15523
- @data['image_size'][5].checked = false
15524
15423
  end
15525
15424
  }
15526
15425
  }
@@ -15531,7 +15430,6 @@ class Wordpress
15531
15430
  @data['image_size'][2].checked = false
15532
15431
  @data['image_size'][0].checked = false
15533
15432
  @data['image_size'][4].checked = false
15534
- @data['image_size'][5].checked = false
15535
15433
  end
15536
15434
  }
15537
15435
  }
@@ -15542,21 +15440,10 @@ class Wordpress
15542
15440
  @data['image_size'][2].checked = false
15543
15441
  @data['image_size'][3].checked = false
15544
15442
  @data['image_size'][0].checked = false
15545
- @data['image_size'][5].checked = false
15546
- end
15547
- }
15548
- }
15549
- @data['image_size'][5] = checkbox('원본 px'){
15550
- on_toggled{
15551
- if @data['image_size'][5].checked?
15552
- @data['image_size'][1].checked = false
15553
- @data['image_size'][2].checked = false
15554
- @data['image_size'][3].checked = false
15555
- @data['image_size'][0].checked = false
15556
- @data['image_size'][4].checked = false
15557
15443
  end
15558
15444
  }
15559
15445
  }
15446
+
15560
15447
  }
15561
15448
  }
15562
15449
  }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posting_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.111.011
4
+ version: 3.111.013
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-06-30 00:00:00.000000000 Z
10
+ date: 2025-07-02 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: File to Clipboard gem
13
13
  email: mymin26@naver.com