Skip to content

Commit

Permalink
Merge pull request #327 from codeforjapan/develop
Browse files Browse the repository at this point in the history
fix some bug
  • Loading branch information
ayuki-joto authored Jan 17, 2022
2 parents 399b3d8 + e5a46a8 commit 2dd3240
Show file tree
Hide file tree
Showing 14 changed files with 211 additions and 110 deletions.
63 changes: 53 additions & 10 deletions .cloudformation/cloud_front.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,27 @@ Resources:
- StorageClass: STANDARD_IA
TransitionInDays: 30

S3Bucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName: !Sub ${AppEnvironment}-cfj-decidim

S3BucketPolicy:
Type: "AWS::S3::BucketPolicy"
Properties:
Bucket: !Sub ${AppEnvironment}-cfj-decidim
PolicyDocument:
Version: "2008-10-17"
Id: "PolicyForCloudFrontPrivateContent"
Statement:
- Sid: "1"
Effect: "Allow"
Principal:
AWS: !Sub "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity ${OriginAccessIdentity}"
Action: "s3:GetObject"
Resource: !Sub "arn:aws:s3:::${AppEnvironment}-cfj-decidim/*"


# ------------------------------------------------------------#
# CloudFront
# ------------------------------------------------------------#
Expand Down Expand Up @@ -84,6 +105,10 @@ Resources:
HTTPSPort: 443
OriginProtocolPolicy: https-only
OriginReadTimeout: 60
- Id: !Sub "${AppEnvironment}-cfj-decidim.s3.ap-northeast-1.amazonaws.com"
DomainName: !Sub "${AppEnvironment}-cfj-decidim.s3.ap-northeast-1.amazonaws.com"
S3OriginConfig:
OriginAccessIdentity: !Sub "origin-access-identity/cloudfront/${OriginAccessIdentity}"
DefaultCacheBehavior:
AllowedMethods:
- GET
Expand All @@ -99,16 +124,28 @@ Resources:
TargetOriginId: appEbOrigin
ViewerProtocolPolicy: redirect-to-https
CacheBehaviors:
- AllowedMethods:
- GET
- HEAD
- OPTIONS
Compress: true
CachePolicyId: !GetAtt StaticCachePolicy.Id
OriginRequestPolicyId: 216adef6-5c7f-47e4-b989-5492eafa07d3
PathPattern: assets/*
TargetOriginId: appEbOrigin
ViewerProtocolPolicy: redirect-to-https
Quantity: 2
Items:
-
PathPattern: assets/*
TargetOriginId: appEbOrigin
CachePolicyId: !GetAtt StaticCachePolicy.Id
OriginRequestPolicyId: 216adef6-5c7f-47e4-b989-5492eafa07d3
ViewerProtocolPolicy: redirect-to-https
AllowedMethods:
- GET
- HEAD
- OPTIONS
Compress: true
-
PathPattern: uploads/*
TargetOriginId: !Sub "${AppEnvironment}-cfj-decidim.s3.ap-northeast-1.amazonaws.com"
ViewerProtocolPolicy: redirect-to-https
AllowedMethods:
- HEAD
- GET
Compress: true
CachePolicyId: 658327ea-f89d-4fab-a63d-7e88639e58f6
HttpVersion: http2
PriceClass: PriceClass_All
ViewerCertificate:
Expand All @@ -134,3 +171,9 @@ Resources:
Tags:
- Key: Name
Value: !Sub ${AppEnvironment}-decidim-cfj-cloud-front

OriginAccessIdentity:
Type: "AWS::CloudFront::CloudFrontOriginAccessIdentity"
Properties:
CloudFrontOriginAccessIdentityConfig:
Comment: "画面用s3にアクセスする用"
10 changes: 6 additions & 4 deletions .cloudformation/waf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ Resources:
- Name: !Sub ${AppEnvironment}-AWSManagedRulesCommonRuleSet
Priority: 0
OverrideAction:
Count: {}
None: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: AWSManagedRulesCommonRuleSetMetric
Statement:
ManagedRuleGroupStatement:
ExcludedRules:
- Name: CrossSiteScripting_BODY
- Name: SizeRestrictions_BODY
- Name: GenericRFI_BODY
VendorName: AWS
Name: AWSManagedRulesCommonRuleSet
- Name: !Sub ${AppEnvironment}-AWSManagedRulesKnownBadInputsRuleSet
Expand Down Expand Up @@ -96,9 +100,7 @@ Resources:
LogDestinationConfigs:
- !Sub ${KinesisDeliveryStreamArn}
RedactedFields:
- Method: {}
- QueryString: {}
- UriPath: {}
- SingleHeader: { Name: cookie }
ResourceArn: !Sub "${WebAclCloudFront.Arn}"
LoggingFilter:
DefaultBehavior: DROP
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# Change Log
## [v0.23.5-2021-11-08](https://github.com/codeforjapan/decidim-cfj/releases/tag/v0.23.5-2021-11-08)
### Fixed
- Fix messages endorsement in JA [#299](https://github.com/codeforjapan/decidim-cfj/pull/299)

## [v0.23.5-2021-10-31](https://github.com/codeforjapan/decidim-cfj/releases/tag/v0.23.5-2021-10-31)

### Added
- chore: add kinesis firehose for waf log [#283](https://github.com/codeforjapan/decidim-cfj/pull/283)

### Fixed
- Fix limit for Decidim::Comments::SortedCommments [#298](https://github.com/codeforjapan/decidim-cfj/pull/298)
- Update changelog & hotfix release [#297](https://github.com/codeforjapan/decidim-cfj/pull/297)

## [v0.23.5-2021-10-27](https://github.com/codeforjapan/decidim-cfj/releases/tag/v0.23.5-2021-10-27)

Expand Down
19 changes: 19 additions & 0 deletions app/uploaders/decidim/application_uploader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@ def store_dir
default_path
end

# Overwrite: If the content block is in preview mode, then we show the
# URL using the asset_host domain
def url(*args)
if path.nil?
default_url(*args)
else
encoded_path = encode_path(path.sub(File.expand_path(root), ""))
if (host = asset_host)
if host.respond_to? :call
"#{host.call(self)}/#{encoded_path}"
else
"#{host}/#{encoded_path}"
end
else
(base_path || "") + encoded_path
end
end
end

protected

# Validates that the associated model is always within an organization in
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/carrierwave.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
config.fog_provider = "fog/aws"
config.fog_public = false
config.fog_directory = ENV.fetch("AWS_BUCKET_NAME", "cfj-decidim")
config.asset_host = "https://s3.ap-northeast-1.amazonaws.com/cfj-decidim"
config.asset_host = ENV.fetch("AWS_CLOUD_FRONT_END_POINT")
config.fog_credentials = {
provider: "AWS",
aws_access_key_id: Rails.application.secrets.aws_access_key_id,
Expand Down
3 changes: 3 additions & 0 deletions config/initializers/fileutils.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

require_relative "../../lib/monkey_patching_fileutils"
135 changes: 42 additions & 93 deletions config/locales/awesome.ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@ ja:
allow_images_in_proposals: 提案エディターでの画像を許可する
allow_images_in_small_editor: ミニマルHTMLエディターでの画像を許可する
auto_save_forms: ローカルストレージにフォームを自動保存する
intergram_auto_no_response: A message that is sent one minute after the user
sends its first message and no response was received
intergram_auto_response: A message that is sent immediately after the user
sends its first message
intergram_chat_id: Chat ID
intergram_color: Color of the widget
intergram_for_admins: Enable Intergram Chat in the admin backend
intergram_intro_message: First message when the user opens the chat for the
first time
intergram_require_login: Only for logged users
intergram_title_closed: Closed chat title
intergram_title_open: Opened chat title
intergram_use_floating_button: If checked, the closed chat is always a button
instead of a text
intergram_auto_no_response: ユーザーが最初のメッセージを送信し、応答が受信されなかった後1分後に送信されたメッセージ
intergram_auto_response: ユーザーが最初のメッセージを送信した直後に送信されるメッセージ
intergram_chat_id: チャットID
intergram_color: ウィジェットの色
intergram_for_admins: 管理画面でIntergram Chatを有効にする
intergram_intro_message: ユーザーが初めてチャットを開いた時最初に表示されるメッセージ
intergram_require_login: ログインユーザーのみ
intergram_title_closed: 閉じられたチャットタイトル
intergram_title_open: 開いたチャットのタイトル
intergram_use_floating_button: チェックした場合、閉じたチャットは常にテキストの代わりにボタンになります
scoped_admins: 'スコープつき管理グループ #%{id}'
scoped_styles: 'カスタムスタイル #%{id}'
use_markdown_editor: HTMLエディターの代わりにMarkdownエディターを使う
Expand All @@ -47,12 +43,9 @@ ja:
global:
announcement: アナウンス
iframe: Iframe コード
iframe_help: 'Put your code as html: <iframe width="100%" height="700"
frameBorder="0" allowFullscreen src="..."></iframe>. Content will be
sanitized from other HTML tags. Ensure to use 100% as width to fill
the screen.'
no_margins: No margins between the iframe and the rest of the page
viewport_width: Limit maximum width to the application viewport
iframe_help: 'あなたのコードを <iframe width="100%" height="700" frameBorder="0" allowFullscreen src="..."></iframe> というHTMLとして入れてください。コンテンツは他のHTMLタグからサニタイズされます。 画面幅を埋めるためにwidthを100%にして使用するようにしてください。'
no_margins: Iframeと残りのページの間に余白はありません
viewport_width: アプリケーションのビューポートを最大幅として制限する
step:
announcement: アナウンス
iframe: Iframe コード
Expand All @@ -61,24 +54,23 @@ ja:
settings:
global:
announcement: アナウンス
collapse: Start with collapsed menu
map_center: Map center (Latitude, Longitude)
map_center_help: 'Use decimal points (ie: 41.38879, 2.15899). Leave it
empty to automatically fit all the markers'
map_height: Map height (px)
map_zoom: Zoom (any number betwen 0 and 18)
map_zoom_help: Only applies if a map center is defined
menu_amendments: Show amendments
menu_hashtags: Show Hasthag search menu
menu_meetings: Show meetings
truncate: Maximum characters for popup descriptions
collapse: メニューは折りたたまれた状態で開始
map_center: マップの中央 (緯度、経度)
map_center_help: '小数点を使用 (例:41.38879、2.15899)。すべてのマーカーに自動的に合うように空のままにします'
map_height: マップの高さ (px)
map_zoom: ズーム ( 0 と 18 の間の任意の数字)
map_zoom_help: 地図の中心が定義されている場合にのみ適用されます
menu_amendments: 修正を表示
menu_hashtags: Hasthag 検索メニューを表示
menu_meetings: ミーティングを表示
truncate: ポップアップの説明のための最大文字数
step:
announcement: Announcement
show_accepted: Show accepted proposals
show_evaluating: Show evaluating proposals
show_not_answered: Show not answered proposals
show_rejected: Show rejected proposals
show_withdrawn: Show withdrawn proposals
announcement: アナウンス
show_accepted: 受理済みの提案を表示
show_evaluating: 評価中の提案を表示
show_not_answered: 未回答の提案を表示
show_rejected: 却下された提案を表示
show_withdrawn: 撤回された提案を表示
decidim_awesome:
admin:
checks:
Expand All @@ -89,10 +81,8 @@ ja:
decidim-proposals: 提案モジュールより
decidim_version: Decidim バージョン %{version}
errors:
CSS: Head does not contain the required <link> stylesheet entries. To
solve it, you can manually add it to your custom _head.html.erb
JavaScript: Head does not contain the required <script> Javascript entries.
To solve it, you can manually add it to your custom admin/_header.html.erb
CSS: 必要な <link> スタイルシートエントリがヘッドに含まれていません。この問題を解決するために、独自の _head.html.erbに手動で追加することもできます。
JavaScript: 必要な <script> JavaScriptエントリがヘッドに含まれていません。この問題を解決するために、独自の admin/_head.html.erbに手動で追加することもできます。
head_tags: アプリケーションヘッダーに含まれる Awesome tags
title: システム互換性チェック
config:
Expand Down Expand Up @@ -136,35 +126,17 @@ ja:
drag_and_drop_supported: 画像アップロード時にドラッグ&ドロップが利用できます。
画像はサーバーにアップロードされ、外部リソースとして挿入されます
(base64インラインエンコーディングは使用しません).
intergram_about: Intergram uses Telegram messenger to handle a live
support chat widget embedded in the bottom of the page.
intergram_config: Invite the <a href="https://web.telegram.org/#/im?p=@IntergramBot">@Intergram
bot</a> to your group or start a chat with it directly. <a href="https://github.com/idoco/intergram#embed-intergram-in-your-website-with-these-2-simple-steps">+
info</a>
scoped_admins: Promote regular user to admins that can only administrate
certain parts of the public web (use the restrictions editor for that).
Note that users who already have regular admin permissions will be
ignored.
scoped_styles: Create custom CSS that applies only in certain parts
of the public web (use the restrictions editor for that)
scoped_styles_variables: 'You can use the following CSS variables for
organization customized colors:'
use_markdown_editor: これはQuill WYSIWYGエディターを置き換えて、
代わりにMarkdownエディターを使えるようにします. テキストはDB内ではHTML形式に変換・保存されます。
form_admins:
new: Add a new "Scoped Admins" group
remove: Remove this "Scoped Admins" group
sure_to_remove: Are you sure you want to destroy this "Scoped Admins"
group?
intergram_about: IntergramはTelegramメッセンジャーを使用してページの下部に埋め込まれたライブサポートチャットウィジェットを処理します。
intergram_config: '<a href="https://web.telegram.org/#/im?p=@IntergramBot">@Intergram bot</a> をグループに招待するか、直接チャットを開始します。 <a href="https://github.com/idoco/intergram#embed-intergram-in-your-website-with-these-2-simple-steps">+ info</a>'
scoped_styles: 公開ウェブの特定の部分にのみ適用されるカスタムCSSを作成します (制限されたエディタを使用してください)
scoped_styles_variables: '組織の色のカスタマイズには、以下のCSS変数が使用できます。'
use_markdown_editor: これはQuill WYSIWYGエディターを置き換えて、代わりにMarkdownエディターを使えるようにします。テキストはDB内ではHTML形式に変換・保存されます。
form_styles:
new: 新しいCSS boxを追加
remove: このCSS boxを削除
sure_to_remove: このCSS boxを本当に削除しますか?
none: "⛔ Never! - Deactivate any other constraint"
process_groups: プロセスグループ
rich_text_editor_in_public_views: 'NOTE: "Rich text editor for participants"
is enabled, this option won''t apply. Use the editors hacks instead to
enable images in proposals.'
rich_text_editor_in_public_views: '注意: 「参加者のためのリッチテキストエディタ」が有効になっているので、このオプションは適用されません。提案で画像を有効にするにはエディタの設定を使用してください。'
show:
title: '%{setting} の詳細設定'
update: 設定を更新する
Expand Down Expand Up @@ -237,34 +209,11 @@ ja:
url_exists: 同じURLがすでに設定されています。もう一度作成し直す前に、内容を修正してください。
config:
intergram:
auto_no_response: It seems that no one is available to answer right now.
Please tell us how we can contact you, and we will get back to you as
soon as we can.
auto_response: Looking for the first available admin (It might take a minute)
intro_message: Hello! How can we help you?
title_closed: Click to chat!
title_open: Let's chat!
content_blocks:
map:
collapse: Start with collapsed menu
map_center: Map center (Latitude, Longitude)
map_center_help: 'Use decimal points (ie: 41.38879, 2.15899). Leave it empty
to automatically fit all the markers'
map_height: Map height (px)
map_settings: Map settings
map_zoom: Zoom (any number betwen 0 and 18)
map_zoom_help: Only applies if a map center is defined
menu_amendments: Show amendments
menu_meetings: Show meetings
name: Awesome Map
show_accepted: Show accepted proposals
show_evaluating: Show evaluating proposals
show_not_answered: Show not answered proposals
show_rejected: Show rejected proposals
show_withdrawn: Show withdrawn proposals
text_settings: Text settings
title: Title
truncate: Maximum characters for popup descriptions
auto_no_response: 現在、回答できる者がおりません。 早急に折り返しご連絡しますので、あなたへの連絡方法を教えてください
auto_response: 最初に利用可能な管理者を探しています (しばらく時間がかかることがあります)
intro_message: 何かお手伝いできることがありますか?
title_closed: クリックしてチャット
title_open: チャットしてみましょう
credits: Decidim Awesome %{version} · Made with ♥ by Platoniq
editor_images:
create:
Expand Down
Loading

0 comments on commit 2dd3240

Please sign in to comment.