Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@
/config/database.yml
/config/config.yml

/public/assets
/public/assets

# files from other forks
/coverage
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
Peer4commit
Prime4commit
==========

[![peercoin tip for next commit](http://peer4commit.com/projects/1.svg)](http://peer4commit.com/projects/1)
[![bitcoin tip for next commit](http://tip4commit.com/projects/560.svg)](http://tip4commit.com/projects/560)
[![peercoin tip for next commit](http://peer4commit.com/projects/16.svg)](http://peer4commit.com/projects/16)

Donate peercoins to open source projects or make commits and get tips for it.

Official site: http://peer4commit.com/
Donate primecoins to open source projects or make commits and get tips for it.

Official site: http://prime4commit.com/


License
=======

[MIT License](https://github.com/sigmike/peer4commit/blob/master/LICENSE)
[MIT License](https://github.com/sigmike/prime4commit/blob/master/LICENSE)

Based on [peer4commit](http://peer4commit.com/), [MIT License](https://github.com/sigmike/peer4commit/blob/master/LICENSE), copyright (c) 2014 sigmike

Based on [Tip4commit](http://tip4commit.com/), [MIT License](https://github.com/tip4commit/tip4commit/blob/master/LICENSE), copyright (c) 2013-2014 tip4commit
Which is based on [Tip4commit](http://tip4commit.com/), [MIT License](https://github.com/tip4commit/tip4commit/blob/master/LICENSE), copyright (c) 2013-2014 tip4commit
Binary file removed app/assets/images/ppcoin.png
Binary file not shown.
Binary file added app/assets/images/primecoin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def show
return
end
if @project.bitcoin_address.nil? and (github_id = @project.github_id).present?
label = "#{github_id}@peer4commit"
label = "#{github_id}@prime4commit"
address = BitcoinDaemon.instance.get_new_address(label)
@project.update_attributes(bitcoin_address: address, address_label: label)
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def update
if @user.update(users_params)
redirect_to @user, notice: 'Your information saved!'
else
render :show, alert: 'Error updating peercoin address'
render :show, alert: 'Error updating primecoin address'
end
end

Expand All @@ -27,7 +27,7 @@ def login
if @user
if params[:unsubscribe]
@user.update unsubscribed: true
flash[:alert] = 'You unsubscribed! Sorry for bothering you. Although, you still can leave us your peercoin address to get your tips.'
flash[:alert] = 'You unsubscribed! Sorry for bothering you. Although, you still can leave us your primecoin address to get your tips.'
end
sign_in_and_redirect @user, event: :authentication
else
Expand Down
10 changes: 4 additions & 6 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def btc_human amount, options = {}
precision = options[:precision] || 2
display_currency = options.fetch(:display_currency, true)
btc = "%.#{precision}f" % to_btc(amount)
btc += " PPC" if display_currency
btc += " XPM" if display_currency
btc = "<span class='convert-from-btc' data-to='#{currency.upcase}'>#{btc}</span>" if currency
btc = "<nobr>#{btc}</nobr>" if nobr
btc.html_safe
Expand All @@ -26,18 +26,16 @@ def to_btc satoshies
end

def transaction_url(txid)
"http://bkchain.org/ppc/tx/#{txid}"
"https://coinplorer.com/XPM/Transactions/#{txid}"
end

def address_explorers
[:bkchain, :blockr, :cryptocoin]
[:coinplorer]
end

def address_url(address, explorer = address_explorers.first)
case explorer
when :blockr then "http://ppc.blockr.io/address/info/#{address}"
when :bkchain then "http://bkchain.org/ppc/address/#{address}"
when :cryptocoin then "http://ppc.cryptocoinexplorer.com/address/#{address}"
when :coinplorer then "https://coinplorer.com/XPM/Addresses/#{address}"
else raise "Unknown provider: #{provider.inspect}"
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/projects_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module ProjectsHelper

def shield_btc_amount amount
btc_amount = to_btc amount
"%.#{6 - btc_amount.to_i.to_s.length}f PPC" % btc_amount
"%.#{5 - btc_amount.to_i.to_s.length}f XPM" % btc_amount
end

def shield_color project
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ def new_tip user, tip

def security_issue(user)
@user = user
mail to: user.email, subject: "Security issue on peer4commit.com"
mail to: user.email, subject: "Security issue on prime4commit.com"
end
end
4 changes: 2 additions & 2 deletions app/views/home/audit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
%th.money
%abbr{title: "Total amount that was donated to the project."} Donated
%th.money
%abbr{title: "#{CONFIG["our_fee"]*100}% Peer4commit maintenance fee, used to pay maintenance, hosting and transaction fees."} Peer4commit Fee
%abbr{title: "#{CONFIG["our_fee"]*100}% Prime4commit maintenance fee, used to pay maintenance, hosting and transaction fees."} Prime4commit Fee
%th.money
%abbr{title: "The balance displayed on the website. The tip amounts are based on this value. This balance includes tips refunded to the project."} Available balance
%th.money
Expand All @@ -28,7 +28,7 @@
%th.money
%abbr{title: "Available balance + tips not sent - amount in cold storage + fee - transaction fee."} Expected account balance
%th.money
%abbr{title: "The balance of the project account as reported by the Peercoin daemon."} Account balance
%abbr{title: "The balance of the project account as reported by the Primecoin daemon."} Account balance
%th.money
%abbr{title: "If it is different than 0 there is an issue."} Difference
%tbody
Expand Down
10 changes: 5 additions & 5 deletions app/views/home/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/ Jumbotron
.jumbotron
%h1 Contribute to Open Source
%p.lead Donate peercoins to open source projects or make commits and get tips for it.
%p.lead Donate primecoins to open source projects or make commits and get tips for it.
/ - if current_user
/ You are logged in as
/ - unless current_user.image.blank?
Expand All @@ -12,7 +12,7 @@
/ Your balance
/ = btc_human current_user.balance
/ \/
/ = link_to current_user.bitcoin_address.blank? ? 'Please set your Peercoin address to receive tips!' : 'Change peercoin address', current_user
/ = link_to current_user.bitcoin_address.blank? ? 'Please set your Primecoin address to receive tips!' : 'Change primecoin address', current_user
/ \/
/ = link_to 'Sign Out', destroy_user_session_path, method: :delete
/ \/
Expand All @@ -25,13 +25,13 @@
.row
.col-lg-4
%h2 How it works?
%p People donate peercoins to projects. When someone's commit is accepted to the project repository, we automatically tip the author.
%p People donate primecoins to projects. When someone's commit is accepted to the project repository, we automatically tip the author.
%p
%a.btn.btn-primary{href: faq_path} Frequently Asked Questions »
.col-lg-4
%h2 Donate
%p
Find a project you like and deposit peercoins to it. Your money will be accumulated with money of other donators to tip for new commits.
Find a project you like and deposit primecoins to it. Your money will be accumulated with money of other donators to tip for new commits.
%p
%a.btn.btn-primary{href: projects_path} Find or add a project »
.col-lg-4
Expand All @@ -44,6 +44,6 @@
%p
%a.btn.btn-primary{href: projects_path} Supported projects »
/ - if current_user
/ %a.btn.btn-primary{href: user_path(current_user)} Change your peercoin address »
/ %a.btn.btn-primary{href: user_path(current_user)} Change your primecoin address »
/ - else
/ %a.btn.btn-primary{href: user_omniauth_authorize_path(:github)} Sign In »
20 changes: 10 additions & 10 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
%meta{content: "width=device-width, initial-scale=1.0", name: "viewport"}/
%meta{content: "", name: "description"}/
%meta{content: "", name: "author"}/
%link{href: image_path("ppcoin.png"), rel: "shortcut icon"}/
%link{href: image_path("primecoin.png"), rel: "shortcut icon"}/

%title= "Peer4Commit — " + (content_for?(:title) ? yield(:title) : "Contribute to Open Source")
%title= "Prime4commit — " + (content_for?(:title) ? yield(:title) : "Contribute to Open Source")

%meta{name: 'description', content: (content_for?(:title) ? yield(:title) : "Donate peercoins to open source projects or make commits and get tips for it.")}
%meta{name: 'keywords', content: 'open source,contribute,github,community,git,bitcoin,peercoin,ppc,tips,perks'}
%meta{name: 'description', content: (content_for?(:title) ? yield(:title) : "Donate primecoins to open source projects or make commits and get tips for it.")}
%meta{name: 'keywords', content: 'open source,contribute,github,community,git,bitcoin,primecoin,xpm,tips,perks'}
/ %meta{:property => 'og:image', :content => asset_path('logo.png')}
/ %link{:rel => 'image_src', :type => 'image/png', :href => asset_path('logo.png')}

Expand All @@ -25,7 +25,7 @@
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-11108334-6', 'peer4commit.com');
ga('create', 'UA-11108334-7', 'prime4commit.com');
ga('send', 'pageview');
.container
.masthead
Expand All @@ -39,21 +39,21 @@
= link_to 'Sign Out', destroy_user_session_path, method: :delete
- else
%a{href: user_omniauth_authorize_path(:github)} Sign in
%h3.text-muted.code-pro Peer4Commit
%h3.text-muted.code-pro Prime4commit
= render 'common/menu'
= render_flash_message
= yield
/ Site footer
.footer
%p
©
= link_to 'Peer4commit', 'http://peer4commit.com/', target: '_blank'
2014. Source code is available at #{link_to('github', 'https://github.com/sigmike/peer4commit', target: '_blank')},
= link_to 'Prime4commit', 'http://prime4commit.com/', target: '_blank'
2014. Source code is available at #{link_to('github', 'https://github.com/sigmike/prime4commit', target: '_blank')},
based on #{link_to "Tip4commit", "http://tip4commit.com/"}.
You can support its development with
= link_to('peercoins', 'http://peer4commit.com/projects/1')
= link_to('peercoins', 'http://peer4commit.com/projects/16')
or
= link_to('bitcoins', 'http://tip4commit.com/projects/560')
= link_to('bitcoins', 'http://tip4commit.com/projects/615')
/ /container
/
Bootstrap core JavaScript
Expand Down
10 changes: 5 additions & 5 deletions app/views/projects/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
%h4.panel-title
Project Sponsors
.panel-body.text-center
%p To give to this project, send peercoins to this address:
%p To give to this project, send primecoins to this address:
%p.bitcoin-address
= @project.bitcoin_address
%p
Expand Down Expand Up @@ -105,15 +105,15 @@
= btc_human @project.next_tip_amount

%h4 Contribute and Earn
Donate peercoins to this project or
Donate primecoins to this project or
= link_to 'make commits', @project.github_url, target: '_blank'
and get tips for it. If your commit is accepted by project maintainer and there are peercoins on its balance, you will get a tip!
and get tips for it. If your commit is accepted by project maintainer and there are primecoins on its balance, you will get a tip!

- if current_user
- if current_user.bitcoin_address.blank?
Just
= link_to 'tell us', current_user
your peercoin address.
your primecoin address.
- else
Just check your email or
%a{href: user_omniauth_authorize_path(:github)} Sign In.
Expand All @@ -131,6 +131,6 @@
/ AddThis Button END

%h4 Embed in README.md
%p= link_to image_tag(project_url(@project, format: :svg), alt: 'Peer4Commit'), project_url(@project)
%p= link_to image_tag(project_url(@project, format: :svg), alt: 'Prime4commit'), project_url(@project)
%p
%input.form-control{type: 'text', value: "[![tip for next commit](#{project_url(@project, format: :svg)})](#{project_url(@project)})"}
4 changes: 2 additions & 2 deletions app/views/projects/show.svg.erb
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@

<g id="vendor">
<path d="M0,9 v-6 q0,-3,3,-3 v18 q-3,0,-3,-3 Z" fill="url(#gray)" />
<rect x="3" y="0" width="<%= width1 = 84 %>" height="22" fill="url(#gray)" />
<rect x="3" y="0" width="<%= width1 = 90 %>" height="22" fill="url(#gray)" />
<text x="6" y="14" font-family="Open Sans" font-size="12" fill="#FFFFFF" style="filter:url(#dropshadow)">
Peer4commit
Prime4commit
</text>
</g>

Expand Down
6 changes: 3 additions & 3 deletions app/views/user_mailer/new_tip.html.haml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
%h4 Hello, #{@user.full_name}!

%p You were tipped #{btc_human @tip.amount} for your commit on Project #{@tip.project.full_name}. Please, log in and tell us your peercoin address to get it.
%p You were tipped #{btc_human @tip.amount} for your commit on Project #{@tip.project.full_name}. Please, log in and tell us your primecoin address to get it.

%p Your current balance is #{btc_human @user.balance}. If you don't enter a peercoin address your tips will be returned to the project in 30 days.
%p Your current balance is #{btc_human @user.balance}. If you don't enter a primecoin address your tips will be returned to the project in 30 days.

%p= link_to 'Sign In', login_users_url(token: @user.login_token)

%p Thanks for contributing to Open Source!

%p= link_to "peer4commit.com", "http://peer4commit.com/"
%p= link_to "prime4commit.com", "http://prime4commit.com/"

%p
%small
Expand Down
6 changes: 3 additions & 3 deletions app/views/user_mailer/security_issue.html.haml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
%h4 Hello #{@user.full_name},

%p We recently discovered a security issue on Peer4commit. This issue allowed someone to change the Peercoin address of other users.
%p We recently discovered a security issue on Prime4commit. This issue allowed someone to change the Primecoin address of other users.

%p
The problem is now fixed. To ensure our database is clean we decided to clear all the addresses.
Please set your Peercoin address again:
Please set your Primecoin address again:
= link_to('Sign in', login_users_url(token: @user.login_token)) + "."

%p We think only one tip was stolen. It will be sent again to its owner when he sets his address.

%p Sorry for this inconvenience.

%p= link_to "peer4commit.com", "http://peer4commit.com/"
%p= link_to "prime4commit.com", "http://prime4commit.com/"

%p
%small
Expand Down
6 changes: 3 additions & 3 deletions app/views/users/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
%p= @user.email
= form_for @user, html: {role: 'form'} do |f|
- if @user.errors.size > 0
.alert.alert-danger Peercoin address is invalid.
.alert.alert-danger Primecoin address is invalid.
.form-group
= f.label :bitcoin_address
= f.text_field :bitcoin_address, class: 'form-control', placeholder: 'Your peercoin address'
= f.text_field :bitcoin_address, class: 'form-control', placeholder: 'Your primecoin address'
= f.button "Update", class: 'btn btn-default'

- if @user.balance > 0
.send-tips-back-block
%p
If you don't want the tips, you can send the funds back to the supported projects:
= button_to "Send all my tips back to their project", send_tips_back_user_path(@user), class: "btn", confirm: "All the #{to_btc @user.balance} peercoins you received will be sent back to their project. Are you sure?"
= button_to "Send all my tips back to their project", send_tips_back_user_path(@user), class: "btn", confirm: "All the #{to_btc @user.balance} primecoins you received will be sent back to their project. Are you sure?"
5 changes: 3 additions & 2 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)

CONFIG ||= YAML::load(File.open("config/config.yml"))
# load config.yaml preprocessed
CONFIG ||= YAML::load(ERB.new(File.read("config/config.yml")).result)

COIN = 1000000 # ppcoin/src/util.h
COIN = 100000000 # primecoin/src/util.h

module T4c
class Application < Rails::Application
Expand Down
10 changes: 5 additions & 5 deletions config/config.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ daemon:
username: rpcuser
password: rpcpassword
host: localhost
port: 9904
path: /path/to/ppcoin/src/ppcoind
port: 9914
path: /path/to/primecoin/src/primecoind

devise:
secret: "111111111111"
Expand Down Expand Up @@ -35,12 +35,12 @@ exception_email: admin@example.com # an email will be sent to this address if an
# host: errbit.tip4commit.com

tip: 0.01
min_payout: 1.0 # in PPC
min_payout: 1.0 # in XPM
our_fee: 0.05
tipper_delay: "1.hour"

address_versions: # 55/117 for peercoin, 111/196 for testnet, see base58.h
address_versions: # 23/83 for primecoin, 111/196 for testnet, see base58.h
- 111
- 196

# canonical_host: peer4commit.example.com # will redirect all other hostnames to this one
# canonical_host: prime4commit.example.com # will redirect all other hostnames to this one
2 changes: 1 addition & 1 deletion config/database.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test:
production:
adapter: mysql2
encoding: utf8
database: peer4commit
database: prime4commit
username: root
password:
socket: /var/run/mysqld/mysqld.sock
2 changes: 1 addition & 1 deletion config/deploy.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set :application, 't4c'
set :repo_url, 'git@github.com:sigmike/peer4commit.git'
set :repo_url, 'git@github.com:sigmike/prime4commit.git'

# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }

Expand Down
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ en:
activerecord:
attributes:
user:
bitcoin_address: Peercoin address
bitcoin_address: Primecoin address
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class InitializeProjectAddressLabel < ActiveRecord::Migration
def up
execute "UPDATE projects SET address_label=(full_name || '@peer4commit') WHERE address_label IS NULL"
execute "UPDATE projects SET address_label=(full_name || '@prime4commit') WHERE address_label IS NULL"
end
end
Loading