Bitcoin Forum

Other => Meta => Topic started by: Alex Zee on June 11, 2011, 08:09:47 AM



Title: [Forum PULL] Support for bitcoin URLs
Post by: Alex Zee on June 11, 2011, 08:09:47 AM
.


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: Vladimir on June 11, 2011, 08:15:55 AM
I asked mods to have a look into it. Fingers crossed.


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: error on June 11, 2011, 08:17:29 AM
Looks like you have a single / after bitcoin: . That isn't going to work.


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: error on June 11, 2011, 02:43:30 PM
Yes, but the URI scheme has NO slashes.


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: error on June 11, 2011, 03:02:14 PM
The bitcoin: URI scheme is not supposed to have any slashes at all, since nothing in Bitcoin is an Internet address or hostname.


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: hamdi on June 11, 2011, 03:19:25 PM
after RFC the old EDONKEY:// schema was also wrong but worked nice.

the uri proposal in the WIKI https://en.bitcoin.it/wiki/URI_Scheme is shit.
the one proposed in the forum is nicer to read


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: error on June 11, 2011, 03:34:42 PM
Sorry, I won't implement a non-RFC compliant URI scheme.


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: error on June 11, 2011, 03:47:50 PM
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?


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: error on June 11, 2011, 04:00:39 PM
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?


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: hamdi on June 11, 2011, 04:04:39 PM
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...


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: generalunited on June 11, 2011, 04:15:34 PM
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..


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: Luke-Jr on June 11, 2011, 04:57:07 PM
Here's a patch to add compliant (https://en.bitcoin.it/wiki/URI_Scheme) 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' => '<a href="$1">$1</a>',
  'validate' => create_function('&$tag, &$data, $disabled', '
  $data = strtr($data, array(\'<br />\' => \'\'));
- 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' => '<a href="$1" target="_blank">$1</a>',
  'validate' => create_function('&$tag, &$data, $disabled', '
  $data = strtr($data, array(\'<br />\' => \'\'));
- 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' => '<a href="$1" target="_blank">',
  'after' => '</a>',
  '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, '&lt;') !== false)
  {
- $data = preg_replace('~&lt;a\s+href=((?:&quot;)?)((?:https?://|ftps?://|mailto:)\S+?)\\1&gt;~i', '[url=$2]', $data);
+ $data = preg_replace('~&lt;a\s+href=((?:&quot;)?)((?:https?://|ftps?://|mailto:|bitcoin:)\S+?)\\1&gt;~i', '[url=$2]', $data);
  $data = preg_replace('~&lt;/a&gt;~i', '[/url]', $data);
 
  // <br /> 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;
 


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: ThomasV on January 17, 2012, 02:00:08 PM
any progress on this?


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: theymos on January 19, 2012, 05:57:23 AM
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).


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: ThomasV on January 19, 2012, 06:12:26 AM
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?

Quote
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.


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: Luke-Jr on January 19, 2012, 07:09:29 AM
I don't like this behavior, especially since a single URI specification hasn't been decided on yet (AFAIK).
Pretty sure the simple bitcoin:<address> case is unanimous.


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: piuk on January 19, 2012, 02:05:19 PM
In order to be compatible with the w3 spec for custom url schemes (http://www.w3.org/TR/html5/timers.html#custom-handlers) 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 (https://developer.mozilla.org/en/DOM/navigator.registerProtocolHandler).


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: piuk on January 19, 2012, 02:10:11 PM
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+


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: ThomasV on January 19, 2012, 02:19:51 PM
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


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: Luke-Jr on January 19, 2012, 02:54:03 PM
In order to be compatible with the w3 spec for custom url schemes (http://www.w3.org/TR/html5/timers.html#custom-handlers) 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 (https://developer.mozilla.org/en/DOM/navigator.registerProtocolHandler).
Then you can have only a website register itself: normal/sane software is not allowed to register for these "web+" URIs.


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: ThomasV on January 19, 2012, 03:15:35 PM
In order to be compatible with the w3 spec for custom url schemes (http://www.w3.org/TR/html5/timers.html#custom-handlers) 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.
Quote

Then you can have your favourite website, not just desktop software, register itself as the bitcoin protocol handler (https://developer.mozilla.org/en/DOM/navigator.registerProtocolHandler).
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.


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: piuk on January 19, 2012, 04:10:00 PM
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:


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: ThomasV on January 23, 2012, 01:45:27 PM
here is how to configure Chrome: http://ecdsa.org/bitcoin_URIs.html


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: Mushoz on April 01, 2012, 12:36:31 PM
Bump! This needs to be implemented! How can we gain widespread adoption if this forum doesn't even support bitcoin URLs?


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: terrytibbs on April 01, 2012, 01:10:04 PM
+1


Title: Re: [Forum PULL] Support for bitcoin URLs
Post by: Herbert on April 05, 2012, 02:47:41 PM
https://bitcointalk.org/index.php?topic=74946.0  ;)