Pages:
Author

Topic: [Forum PULL] Support for bitcoin URLs (Read 4461 times)

hero member
Activity: 560
Merit: 501
April 01, 2012, 09:10:04 AM
#25
+1
hero member
Activity: 686
Merit: 500
Bitbuy
April 01, 2012, 08:36:31 AM
#24
Bump! This needs to be implemented! How can we gain widespread adoption if this forum doesn't even support bitcoin URLs?
legendary
Activity: 1896
Merit: 1353
January 23, 2012, 09:45:27 AM
#23
here is how to configure Chrome: http://ecdsa.org/bitcoin_URIs.html
hero member
Activity: 910
Merit: 1005
January 19, 2012, 12:10:00 PM
#22
Your right I can't find it in the spec now either. Some mention on http://dev.w3.org/html5/spec/iana.html perhaps they have depreciated it http://lists.w3.org/Archives/Public/public-html/2011Aug/0397.html.

Put up a test page here:

http://blockchain.info/uri

bitcoin: registered with Firefox 9 - Chrome 16 would only register web+bitcoin:
legendary
Activity: 1896
Merit: 1353
January 19, 2012, 11:15:35 AM
#21
In order to be compatible with the w3 spec for custom url schemes it would be good if the chosen URI was prefixed with web+ e.g.

web+bitcoin://
This will be an epic failure for w3c if it goes through like this. Be sure to write them and tell them how ridiculous these custom URI rules are. More important to comply with the long-standing IETF RFCs, which we already do.

Sorry but I see no evidence that the web+ prefix is required, or even suggested by w3c.
This prefix seems to be requested only by Chrome, according to the page linked above.
I made some tests:
I was able to register a website handling "bitcoin:" in Firefox, using javascript.
The same javascript failed in Chrome, not because of the prefix, but because the method is not defined.
Then you can have your favourite website, not just desktop software, register itself as the bitcoin protocol handler.
Then you can have only a website register itself: normal/sane software is not allowed to register for these "web+" URIs.
You can register the bitcoin: protocol with a desktop app and a website. The popup window lets you choose when you click on a bitcoin: link. I tested it.
legendary
Activity: 2576
Merit: 1186
January 19, 2012, 10:54:03 AM
#20
In order to be compatible with the w3 spec for custom url schemes it would be good if the chosen URI was prefixed with web+ e.g.

web+bitcoin://
This will be an epic failure for w3c if it goes through like this. Be sure to write them and tell them how ridiculous these custom URI rules are. More important to comply with the long-standing IETF RFCs, which we already do.

Then you can have your favourite website, not just desktop software, register itself as the bitcoin protocol handler.
Then you can have only a website register itself: normal/sane software is not allowed to register for these "web+" URIs.
legendary
Activity: 1896
Merit: 1353
January 19, 2012, 10:19:51 AM
#19
huh? are you saying that web-based protocols require a web+ prefix?

Yeah in order to register a custom scheme with your browser it must start with web+

yes, I just read that too. this restriction seems to apply to Chrome only.
https://developer.mozilla.org/en/DOM/navigator.registerProtocolHandler
hero member
Activity: 910
Merit: 1005
January 19, 2012, 10:10:11 AM
#18
huh? are you saying that web-based protocols require a web+ prefix?

Yeah in order to register a custom scheme with your browser it must start with web+
hero member
Activity: 910
Merit: 1005
January 19, 2012, 10:05:19 AM
#17
In order to be compatible with the w3 spec for custom url schemes it would be good if the chosen URI was prefixed with web+ e.g.

web+bitcoin://

Then you can have your favourite website, not just desktop software, register itself as the bitcoin protocol handler.
legendary
Activity: 2576
Merit: 1186
January 19, 2012, 03:09:29 AM
#16
I don't like this behavior, especially since a single URI specification hasn't been decided on yet (AFAIK).
Pretty sure the simple bitcoin:
case is unanimous.
legendary
Activity: 1896
Merit: 1353
January 19, 2012, 02:12:26 AM
#15
That section of the code starts with "WARNING: Editing the below can cause large security holes in your forum," so a lot of testing would be necessary to make sure that these changes are safe. (I don't have a test forum set up, so I can't really test it.)
that's a pity; is no admin able to test patches for this forum?

It also tries to detect standalone bitcoin addresses and turn them into links.
I don't like this behavior, especially since a single URI specification hasn't been decided on yet (AFAIK).
I agree that detection of standalone addresses is not a good idea; it should be removed.
However, the lack of URI specification should not be a problem for a forum patch; all the patch has to do is to give users the ability to write bitcoin: links.
administrator
Activity: 5222
Merit: 13032
January 19, 2012, 01:57:23 AM
#14
That section of the code starts with "WARNING: Editing the below can cause large security holes in your forum," so a lot of testing would be necessary to make sure that these changes are safe. (I don't have a test forum set up, so I can't really test it.)

It also tries to detect standalone bitcoin addresses and turn them into links.

I don't like this behavior, especially since a single URI specification hasn't been decided on yet (AFAIK).
legendary
Activity: 1896
Merit: 1353
January 17, 2012, 10:00:08 AM
#13
any progress on this?
legendary
Activity: 2576
Merit: 1186
June 11, 2011, 12:57:07 PM
#12
Here's a patch to add compliant support for bitcoin: URIs. It probably should cleanup/strip any extra //, but I'll leave that to someone else to figure out. It also tries to detect standalone bitcoin addresses and turn them into links. I haven't tested it at all, so use at your own risk. Donations for this patch to 1HXo9py5hFsa528ZuXnSPHcXMyKiB7GN5U

Code:
diff -ur smf_1-1-13_install/Sources/Subs-Post.php smf_1-1-13_install.bitcoin/Sources/Subs-Post.php
--- smf_1-1-13_install/Sources/Subs-Post.php 2011-02-07 11:45:09.000000000 -0500
+++ smf_1-1-13_install.bitcoin/Sources/Subs-Post.php 2011-06-11 12:29:56.169981884 -0400
@@ -330,28 +330,28 @@
  // [url]http://...[/url]
  array(
  'tag' => 'url',
- 'protocols' => array('http', 'https'),
+ 'protocols' => array('http', 'https', 'bitcoin:'),
  'embeddedUrl' => true,
  'hasEqualSign' => false,
  ),
  // [url=http://...]name[/url]
  array(
  'tag' => 'url',
- 'protocols' => array('http', 'https'),
+ 'protocols' => array('http', 'https', 'bitcoin:'),
  'embeddedUrl' => true,
  'hasEqualSign' => true,
  ),
  // [iurl]http://...[/iurl]
  array(
  'tag' => 'iurl',
- 'protocols' => array('http', 'https'),
+ 'protocols' => array('http', 'https', 'bitcoin:'),
  'embeddedUrl' => true,
  'hasEqualSign' => false,
  ),
  // [iurl=http://...]name[/iurl]
  array(
  'tag' => 'iurl',
- 'protocols' => array('http', 'https'),
+ 'protocols' => array('http', 'https', 'bitcoin:'),
  'embeddedUrl' => true,
  'hasEqualSign' => true,
  ),
@@ -475,7 +475,10 @@
  $found = false;
  foreach ($protocols as $protocol)
  {
+ if (strpos($protocol, ':') === false)
  $found = strncasecmp($replace, $protocol . '://', strlen($protocol) + 3) === 0;
+ else
+ $found = strncasecmp($replace, $protocol, strlen($protocol)) === 0;
  if ($found)
  break;
  }
diff -ur smf_1-1-13_install/Sources/Subs.php smf_1-1-13_install.bitcoin/Sources/Subs.php
--- smf_1-1-13_install/Sources/Subs.php 2011-02-07 11:45:09.000000000 -0500
+++ smf_1-1-13_install.bitcoin/Sources/Subs.php 2011-06-11 12:53:18.829672859 -0400
@@ -1330,7 +1330,7 @@
  'content' => '$1',
  'validate' => create_function('&$tag, &$data, $disabled', '
  $data = strtr($data, array(\'
\' => \'\'));
- if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
+ if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0 && strpos($data, \'bitcoin:\') !== 0)
  $data = \'http://\' . $data;
  '),
  ),
@@ -1342,7 +1342,7 @@
  'validate' => create_function('&$tag, &$data, $disabled', '
  if (substr($data, 0, 1) == \'#\')
  $data = \'#post_\' . substr($data, 1);
- elseif (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
+ elseif (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0 && strpos($data, \'bitcoin:\') !== 0)
  $data = \'http://\' . $data;
  '),
  'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
@@ -1599,7 +1599,7 @@
  'content' => '$1',
  'validate' => create_function('&$tag, &$data, $disabled', '
  $data = strtr($data, array(\'
\' => \'\'));
- if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
+ if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0 && strpos($data, \'bitcoin:\') !== 0)
  $data = \'http://\' . $data;
  '),
  ),
@@ -1609,7 +1609,7 @@
  'before' => '',
  'after' => '
',
  'validate' => create_function('&$tag, &$data, $disabled', '
- if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
+ if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0 && strpos($data, \'bitcoin:\') !== 0)
  $data = \'http://\' . $data;
  '),
  'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
@@ -1747,7 +1747,7 @@
  // Take care of some HTML!
  if (!empty($modSettings['enablePostHTML']) && strpos($data, '<') !== false)
  {
- $data = preg_replace('~<a\s+href=((?:")?)((?:https?://|ftps?://|mailto:)\S+?)\\1>~i', '[url=$2]', $data);
+ $data = preg_replace('~<a\s+href=((?:")?)((?:https?://|ftps?://|mailto:|bitcoin:)\S+?)\\1>~i', '[url=$2]', $data);
  $data = preg_replace('~</a>~i', '[/url]', $data);
 
  //
should be empty.
@@ -1836,10 +1836,14 @@
  // Only do this if the preg survives.
  if (is_string($result = preg_replace(array(
  '~(?<=[\s>\.(;\'"]|^)((?:http|https|ftp|ftps)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i',
- '~(?<=[\s>(\'<]|^)(www(?:\.[\w\-_]+)+(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i'
+ '~(?<=[\s>(\'<]|^)(www(?:\.[\w\-_]+)+(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i',
+ '~bitcoin:(\w+(?:\?\S+)?)~i',
+ '~\b([1-9A-HJ-NP-Za-km-z]{26,35})\b'
  ), array(
  '[url]$1[/url]',
- '[url=http://$1]$1[/url]'
+ '[url=http://$1]$1[/url]',
+ '[url]$1[/url]',
+ '[url=bitcoin:$1]$1[/url]',
  ), $data)))
  $data = $result;
 
newbie
Activity: 14
Merit: 0
June 11, 2011, 12:15:34 PM
#11
link them all over to blockexplorer.com --- anything to make that plain text clickable without having to install a browser extension is going to help in bringing wider adoption to bitcoins... just my two cents..
hero member
Activity: 826
Merit: 500
June 11, 2011, 12:04:39 PM
#10
according to RFC after a :// a HOSTNAME must follow..
an amount or a btc-address is no hostname
so it is wrong in terms of RFC´s uri schema concept

read up on MAGNET:// and ED2K:// for example...
hero member
Activity: 588
Merit: 500
June 11, 2011, 12:00:39 PM
#9
WTF??? I though at least people in charge here are not that stupid...

Have you even READ any of the RFCs in question? Do you even know what an RFC is?
hero member
Activity: 588
Merit: 500
June 11, 2011, 11:47:50 AM
#8
What are you talking about? It's completely compliant.

If http:// and file:// are Ok, bitcoin:// is no different.

Please read this:

http://en.wikipedia.org/wiki/Uniform_Resource_Identifier

Really? You're sourcing Wikipedia instead of a relevant RFC?
hero member
Activity: 588
Merit: 500
June 11, 2011, 11:34:42 AM
#7
Sorry, I won't implement a non-RFC compliant URI scheme.
Pages:
Jump to: