BitShares Forum

Main => Stakeholder Proposals => Topic started by: toast on July 23, 2014, 03:18:51 am

Title: How to make "approve" buttons
Post by: toast on July 23, 2014, 03:18:51 am
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! (http://daslab.io/scheme/btsx/daslab/approve)

Vote out this unreliable delegate! (http://daslab.io/scheme/btsx/viv/disapprove)
And this one! (http://daslab.io/scheme/btsx/mister/disapprove)
This one too! (http://daslab.io/scheme/btsx/btsdac-delegate/disapprove)

(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)
Title: Re: How to make "approve" buttons
Post by: 8bit on July 23, 2014, 04:33:21 am
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! (http://the8thbit.github.io/bitshares.html?name=eightbit&action=approve)

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.
Title: Re: How to make "approve" buttons
Post by: toast on July 23, 2014, 05:42:16 am
> 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
Title: Re: How to make "approve" buttons
Post by: 8bit on July 23, 2014, 06:17:12 am
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!