This commit is contained in:
2025-06-07 18:54:10 +09:00
parent e8760ca1d8
commit b61027be4b
9 changed files with 226 additions and 3 deletions
+2
View File
@@ -36,3 +36,5 @@
/config/database.yml
/config/credentials/production.key
/wiki
+2
View File
@@ -55,3 +55,5 @@ gem "mysql2", "~> 0.5.6"
gem "image_processing", "~> 1.14"
gem "nokogiri", "~> 1.18"
gem 'gollum'
+84
View File
@@ -100,8 +100,41 @@ GEM
ffi (1.17.2-x86_64-darwin)
ffi (1.17.2-x86_64-linux-gnu)
ffi (1.17.2-x86_64-linux-musl)
gemojione (4.3.3)
json
github-markup (4.0.2)
globalid (1.2.1)
activesupport (>= 6.1)
gollum (6.1.0)
gemojione (~> 4.1)
gollum-lib (~> 6.0)
i18n (~> 1.8)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.1.0)
mustache-sinatra (~> 2.0)
octicons (~> 19.0)
rack (>= 3.0)
rackup (~> 2.1)
rdoc (~> 6)
rss (~> 0.3)
sinatra (~> 4.0)
sinatra-contrib (~> 4.0)
sprockets (~> 4.1)
sprockets-helpers (~> 1.2)
therubyrhino (~> 2.1.0)
useragent (~> 0.16.2)
webrick (~> 1.7)
gollum-lib (6.0)
gemojione (~> 4.1)
github-markup (~> 4.0)
gollum-rugged_adapter (~> 3.0)
loofah (~> 2.3)
nokogiri (~> 1.8)
rouge (~> 3.1)
twitter-text (= 1.14.7)
gollum-rugged_adapter (3.0)
mime-types (~> 3.4)
rugged (~> 1.5)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
image_processing (1.14.0)
@@ -126,6 +159,10 @@ GEM
sshkit (>= 1.23.0, < 2.0)
thor (~> 1.3)
zeitwerk (>= 2.6.18, < 3.0)
kramdown (2.5.1)
rexml (>= 3.3.9)
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.7.0)
@@ -138,12 +175,22 @@ GEM
net-pop
net-smtp
marcel (1.0.4)
mime-types (3.7.0)
logger
mime-types-data (~> 3.2025, >= 3.2025.0507)
mime-types-data (3.2025.0603)
mini_magick (5.2.0)
benchmark
logger
mini_mime (1.1.5)
minitest (5.25.5)
msgpack (1.8.0)
multi_json (1.15.0)
mustache (1.1.1)
mustache-sinatra (2.0.0)
mustache (~> 1.0)
mustermann (3.0.3)
ruby2_keywords (~> 0.0.1)
mysql2 (0.5.6)
net-imap (0.5.8)
date
@@ -176,6 +223,7 @@ GEM
racc (~> 1.4)
nokogiri (1.18.8-x86_64-linux-musl)
racc (~> 1.4)
octicons (19.15.2)
ostruct (0.6.1)
parallel (1.27.0)
parser (3.3.8.0)
@@ -194,6 +242,10 @@ GEM
rack (3.1.14)
rack-cors (2.0.2)
rack (>= 2.0.0)
rack-protection (4.1.1)
base64 (>= 0.1.0)
logger (>= 1.6.0)
rack (>= 3.0.0, < 4)
rack-session (2.1.1)
base64 (>= 0.1.0)
rack (>= 3.0.0)
@@ -237,6 +289,10 @@ GEM
regexp_parser (2.10.0)
reline (0.6.1)
io-console (~> 0.5)
rexml (3.4.1)
rouge (3.30.0)
rss (0.3.1)
rexml
rubocop (1.75.6)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
@@ -269,11 +325,28 @@ GEM
ruby-vips (2.2.3)
ffi (~> 1.12)
logger
ruby2_keywords (0.0.5)
rugged (1.9.0)
securerandom (0.4.1)
sinatra (4.1.1)
logger (>= 1.6.0)
mustermann (~> 3.0)
rack (>= 3.0.0, < 4)
rack-protection (= 4.1.1)
rack-session (>= 2.0.0, < 3)
tilt (~> 2.0)
sinatra-contrib (4.1.1)
multi_json (>= 0.0.2)
mustermann (~> 3.0)
rack-protection (= 4.1.1)
sinatra (= 4.1.1)
tilt (~> 2.0)
sprockets (4.2.2)
concurrent-ruby (~> 1.0)
logger
rack (>= 2.2.4, < 4)
sprockets-helpers (1.4.0)
sprockets (>= 2.2)
sprockets-rails (3.5.2)
actionpack (>= 6.1)
activesupport (>= 6.1)
@@ -294,20 +367,30 @@ GEM
net-ssh (>= 2.8.0)
ostruct
stringio (3.1.7)
therubyrhino (2.1.2)
therubyrhino_jar (>= 1.7.4, < 1.7.9)
therubyrhino_jar (1.7.8)
thor (1.3.2)
thruster (0.1.13)
thruster (0.1.13-aarch64-linux)
thruster (0.1.13-arm64-darwin)
thruster (0.1.13-x86_64-darwin)
thruster (0.1.13-x86_64-linux)
tilt (2.6.0)
timeout (0.4.3)
twitter-text (1.14.7)
unf (~> 0.1.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.9.1)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.3)
useragent (0.16.11)
webrick (1.9.1)
websocket-driver (0.7.7)
base64
websocket-extensions (>= 0.1.0)
@@ -329,6 +412,7 @@ PLATFORMS
DEPENDENCIES
bootsnap
brakeman
gollum
image_processing (~> 1.14)
jwt
kamal
@@ -0,0 +1,31 @@
require 'net/http'
require 'uri'
class WikiProxyController < ApplicationController
def edit
tag = params[:tag]
uri = "http://localhost:4567/gollum/edit/#{ URI.encode_www_form_component(tag) }"
begin
res = fetch_with_redirect(uri)
render html: res.body.html_safe, content_type: res.content_type
rescue => e
render plain: "Wiki システムとの通信に失敗しました:#{ e.message }", status: 502
end
end
private
def fetch_with_redirect uri_str, limit = 5
raise 'Too many redirects' if limit == 0
uri = URI.parse(uri_str)
res = Net::HTTP.get_response(uri)
if res.is_a? Net::HTTPRedirection
location = res['location']
fetch_with_redirect(location, limit - 1)
else
res
end
end
end
+1
View File
@@ -54,6 +54,7 @@ Rails.application.routes.draw do
get "ip_addresses/destroy"
get 'preview/title', to: 'preview#title'
get 'preview/thumbnail', to: 'preview#thumbnail'
get '/wiki/edit/:tag', to: 'wiki_proxy#edit'
root 'home#index'
resources :posts