Author Topic: How to make "approve" buttons  (Read 2771 times)

0 Members and 1 Guest are viewing this topic.

Offline 8bit

  • Full Member
  • ***
  • Posts: 56
    • View Profile
Quote
> I can't tell for sure as I don't run the GUI client

Well there's your problem, the hooks are only installed when you install the GUI.

Yeah, I was just confused because I wrote it client side and got a more descriptive error from the browser when I did that.

The "code" is this line in apache config:

Code: [Select]
RedirectMatch ^/scheme/btsx/(.*)$ btsx:$1

Ah, that's clever!
Code: [Select]
wallet_approve_delegate eightbitA VOTE FOR EIGHTBIT IS A VOTE FOR CRUDE DICK ART

Offline toast

  • Hero Member
  • *****
  • Posts: 4001
    • View Profile
  • BitShares: nikolai
> I can't tell for sure as I don't run the GUI client

Well there's your problem, the hooks are only installed when you install the GUI.

> Btw, where is the repo for your version? I had trouble finding it, and I'd like to read through your code to see where the problem might be.

The "code" is this line in apache config:

Code: [Select]
RedirectMatch ^/scheme/btsx/(.*)$ btsx:$1
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

Offline 8bit

  • Full Member
  • ***
  • Posts: 56
    • View Profile
I'm in Firefox 30 and this doesn't seem to do anything for me. I just get a whitescreen, no redirect to btsx://etc... However I came up with this idea independently and created a slightly different implementation that might work in browsers that yours does not work in:

Quote
Approve me on the forums!

The syntax is:

Code: [Select]
[url=http://the8thbit.github.io/bitshares.html?name=NAMEt&action=ACTION]TEXT[/url]

With the stuff in caps replaced with whatever you want. So for example, this is how I did the one above:

Code: [Select]
[url=http://the8thbit.github.io/bitshares.html?name=eightbit&action=approve]Approve me on the forums![/url]

Instead of using multiple directories as you seem to be doing, I'm using a single html file with inline js that extracts URL parameters and then uses them to construct a new URL which you are then redirected to. It's all very basic js, so it should work in most browsers. That said, I can't tell for sure as I don't run the GUI client, but it gives me the redirect to the btsx URL. At that point, your browser/wallet should figure out the rest.

Anyone want to try this one and tell me if it works?

Btw, where is the repo for your version? I had trouble finding it, and I'd like to read through your code to see where the problem might be.
Code: [Select]
wallet_approve_delegate eightbitA VOTE FOR EIGHTBIT IS A VOTE FOR CRUDE DICK ART

Offline toast

  • Hero Member
  • *****
  • Posts: 4001
    • View Profile
  • BitShares: nikolai
The client has support for direct-linking to actions.

Replace "NAME" with an account name.

Anywhere outside of simplemachines forum:

Link to account:
Code: [Select]
<a href="btsx:NAME">Visit my account page</a>
One-click approve:
Code: [Select]
<a href="btsx:NAME/approve">Approve my delegate</a>
One-click unapprove:
Code: [Select]
<a href="btsx:NAME/disapprove">Vote out this bad delegate!</a>

In simplemachines forum (including bitsharestalk.org) or anywhere it hijacks non-http schemes:
(thanks nathanhrout for the redirect idea)
Code: [Select]
[url=daslab.io/scheme/btsx/NAME]Visit my account page.[/url]
[url=daslab.io/scheme/btsx/NAME/approve]Approve my delegate.[/url]
[url=daslab.io/scheme/btsx/NAME/disapprove]Vote out this bad delegate![/url]


Try it out


Approve my delegate!

Vote out this unreliable delegate!
And this one!
This one too!

(note that the app's thumb does not reflect the true state directly after using approve/disapprove url - we'll fix this for next release)
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.