diff --git a/.gitignore b/.gitignore index c74ce787..6f59d3fe 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,7 @@ /config/database.yml /config/config.yml -/public/assets \ No newline at end of file +/public/assets + +# files from other forks +/coverage diff --git a/README.md b/README.md index 8edf630a..341943dc 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/app/assets/images/ppcoin.png b/app/assets/images/ppcoin.png deleted file mode 100644 index 62a291c1..00000000 Binary files a/app/assets/images/ppcoin.png and /dev/null differ diff --git a/app/assets/images/primecoin.png b/app/assets/images/primecoin.png new file mode 100644 index 00000000..63e9d4a1 Binary files /dev/null and b/app/assets/images/primecoin.png differ diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index adb77030..b115b6cb 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8ed0650e..2debdf5b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 @@ -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 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c00ec64c..b7397704 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 = "#{btc}" if currency btc = "#{btc}" if nobr btc.html_safe @@ -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 diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 2de77218..8843dfe8 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -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 diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index f585efb9..8233c207 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -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 diff --git a/app/views/home/audit.html.haml b/app/views/home/audit.html.haml index 54e6f0fa..23e3b6ce 100644 --- a/app/views/home/audit.html.haml +++ b/app/views/home/audit.html.haml @@ -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 @@ -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 diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index e26975de..9e4b72c4 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -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? @@ -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 / \/ @@ -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 @@ -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 » diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 2fee79ed..66c12bde 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -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')} @@ -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 @@ -39,7 +39,7 @@ = 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 @@ -47,13 +47,13 @@ .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 diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 5422573b..e2be7bcc 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -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 @@ -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. @@ -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)})"} diff --git a/app/views/projects/show.svg.erb b/app/views/projects/show.svg.erb index 38dd757c..2c1f50fa 100644 --- a/app/views/projects/show.svg.erb +++ b/app/views/projects/show.svg.erb @@ -71,9 +71,9 @@ - + - Peer4commit + Prime4commit diff --git a/app/views/user_mailer/new_tip.html.haml b/app/views/user_mailer/new_tip.html.haml index ddbaad6b..1c3aa531 100644 --- a/app/views/user_mailer/new_tip.html.haml +++ b/app/views/user_mailer/new_tip.html.haml @@ -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 diff --git a/app/views/user_mailer/security_issue.html.haml b/app/views/user_mailer/security_issue.html.haml index d503374c..313c869a 100644 --- a/app/views/user_mailer/security_issue.html.haml +++ b/app/views/user_mailer/security_issue.html.haml @@ -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 diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 05b63c43..02eb5c05 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -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?" diff --git a/config/application.rb b/config/application.rb index 59da21f9..b9b99103 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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 diff --git a/config/config.yml.sample b/config/config.yml.sample index 433bdd96..ac94c7ea 100644 --- a/config/config.yml.sample +++ b/config/config.yml.sample @@ -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" @@ -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 diff --git a/config/database.yml.sample b/config/database.yml.sample index 35ef0e07..13f30c76 100644 --- a/config/database.yml.sample +++ b/config/database.yml.sample @@ -21,7 +21,7 @@ test: production: adapter: mysql2 encoding: utf8 - database: peer4commit + database: prime4commit username: root password: socket: /var/run/mysqld/mysqld.sock diff --git a/config/deploy.rb b/config/deploy.rb index 85a44849..05be758d 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -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 } diff --git a/config/locales/en.yml b/config/locales/en.yml index e618cddd..fe9eb005 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -25,4 +25,4 @@ en: activerecord: attributes: user: - bitcoin_address: Peercoin address + bitcoin_address: Primecoin address diff --git a/db/migrate/20140215094549_initialize_project_address_label.rb b/db/migrate/20140215094549_initialize_project_address_label.rb index 8bcc6116..ee5ee560 100644 --- a/db/migrate/20140215094549_initialize_project_address_label.rb +++ b/db/migrate/20140215094549_initialize_project_address_label.rb @@ -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 diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature index 26b2fbaa..571047bc 100644 --- a/features/tip_modifier_interface.feature +++ b/features/tip_modifier_interface.feature @@ -102,7 +102,7 @@ Feature: A project collaborator can change the tips of commits And I choose the amount "Huge: 5%" on all commits And I click on "Send the selected tip amounts" Then there should be a tip of "25" for commit "BBB" - And there should be a tip of "8.088338" for commit "last" + And there should be a tip of "8.08833862" for commit "last" Scenario Outline: A collaborator changes the amount of a tip on another project Given the project holds tips diff --git a/lib/bitcoin_address_validator.rb b/lib/bitcoin_address_validator.rb index 7332bd7a..67140a4d 100644 --- a/lib/bitcoin_address_validator.rb +++ b/lib/bitcoin_address_validator.rb @@ -3,7 +3,7 @@ class BitcoinAddressValidator < ActiveModel::EachValidator def validate_each(record, field, value) unless value.blank? || valid_bitcoin_address?(value) - record.errors[field] << "Peercoin address is invalid" + record.errors[field] << "Primecoin address is invalid" end end