[deploy] Implement web-monetization/payment pointer (#6345)
* WIP payment pointer * Add payment pointer config * Add proper siteconfig var to view * Finalize * Fix typo Co-authored-by: Andy Zhao <17884966+Zhao-Andy@users.noreply.github.com>
This commit is contained in:
parent
35eb4f1f72
commit
b51d56159a
5 changed files with 31 additions and 5 deletions
|
|
@ -46,6 +46,7 @@ class Internal::ConfigsController < Internal::ApplicationController
|
|||
twitter_hashtag
|
||||
suggested_users
|
||||
tagline
|
||||
payment_pointer
|
||||
]
|
||||
|
||||
allowed_params = allowed_params |
|
||||
|
|
|
|||
|
|
@ -73,7 +73,10 @@ class SiteConfig < RailsSettings::Base
|
|||
field :logo_svg, type: :string, default: ""
|
||||
field :primary_sticker_image_url, type: :string, default: "https://practicaldev-herokuapp-com.freetls.fastly.net/assets/rainbowdev.svg"
|
||||
|
||||
# Rate Limits
|
||||
# Monetization
|
||||
field :payment_pointer, type: :string, default: "$ilp.uphold.com/24HhrUGG7ekn" # Experimental
|
||||
|
||||
# Rate limits
|
||||
field :rate_limit_follow_count_daily, type: :integer, default: 500
|
||||
field :rate_limit_comment_creation, type: :integer, default: 9
|
||||
field :rate_limit_listing_creation, type: :integer, default: 1
|
||||
|
|
|
|||
|
|
@ -565,12 +565,12 @@
|
|||
<div class="card mt-3">
|
||||
<%= render partial: "card_header",
|
||||
locals: {
|
||||
header: "Shop",
|
||||
header: "Monetization",
|
||||
state: "collapse",
|
||||
target: "shopBodyContainer",
|
||||
target: "monetizationBodyContainer",
|
||||
expanded: "false"
|
||||
} %>
|
||||
<div id="shopBodyContainer" class="card-body collapse hide" aria-labelledby="shopBodyContainer">
|
||||
<div id="monetizationBodyContainer" class="card-body collapse hide" aria-labelledby="monetizationBodyContainer">
|
||||
<div class="form-group">
|
||||
<%= f.label :shop_url %>
|
||||
<%= f.text_field :shop_url,
|
||||
|
|
@ -579,9 +579,17 @@
|
|||
placeholder: "Shop url" %>
|
||||
<div class="alert alert-info">Used as the shop url of the community</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.label :payment_pointer %>
|
||||
<%= f.text_field :payment_pointer,
|
||||
class: "form-control",
|
||||
value: SiteConfig.payment_pointer,
|
||||
placeholder: "$pay.somethinglikethis.co/value" %>
|
||||
<div class="alert alert-info">Used for site-wide web monetization (<a href="https://github.com/thepracticaldev/dev.to/pull/6345">experimental</a>)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if current_user.has_role?(:single_resource_admin, Config) %>
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">Confirm and Submit</div>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,13 @@
|
|||
<% unless internal_navigation? %>
|
||||
<meta name="last-updated" content="<%= Time.current %>">
|
||||
<meta name="user-signed-in" content="<%= user_signed_in? %>">
|
||||
<!-- Expermiental web monetization payment pointer for micropayments -->
|
||||
<!-- It lets readers make micropayments to websites they visit. -->
|
||||
<!-- This is step 1: Get live in production to test for platform-wide payment pointer. -->
|
||||
<!-- Step 2: Allow authors to set their payment pointer so they can directly monetize their content based on visitors. -->
|
||||
<!-- Step 3: Enable further functionality based on what we learn from this experimentation and how the ecosystem evolves. -->
|
||||
<!-- Step 3: Enable further functionality based on what we learn from this experimentation and how the ecosystem evolves. -->
|
||||
<meta name="monetization" content="<%= SiteConfig.payment_pointer %>">
|
||||
<meta name="environment" content="<%= Rails.env %>">
|
||||
<%= render "layouts/styles" %>
|
||||
<style>
|
||||
|
|
|
|||
|
|
@ -194,6 +194,13 @@ RSpec.describe "/internal/config", type: :request do
|
|||
end
|
||||
end
|
||||
|
||||
describe "monetization" do
|
||||
it "updates payment pointer" do
|
||||
post "/internal/config", params: { site_config: { payment_pointer: "$pay.yo" }, confirmation: confirmation_message }
|
||||
expect(SiteConfig.payment_pointer).to eq("$pay.yo")
|
||||
end
|
||||
end
|
||||
|
||||
describe "rate limits" do
|
||||
it "updates rate_limit_follow_count_daily" do
|
||||
expect do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue