Bitcoin Forum
December 11, 2016, 12:29:05 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1] 2 »  All
  Print  
Author Topic: [Forum PULL] Support for bitcoin URLs  (Read 4076 times)
Alex Zee
Member
**
Offline Offline

Activity: 112



View Profile WWW
June 11, 2011, 08:09:47 AM
 #1

.

BTC Monitor - systray price ticker
RipTalk.org - new Ripple forum
1481416145
Hero Member
*
Offline Offline

Posts: 1481416145

View Profile Personal Message (Offline)

Ignore
1481416145
Reply with quote  #2

1481416145
Report to moderator
1481416145
Hero Member
*
Offline Offline

Posts: 1481416145

View Profile Personal Message (Offline)

Ignore
1481416145
Reply with quote  #2

1481416145
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
Vladimir
Hero Member
*****
Offline Offline

Activity: 812


-


View Profile
June 11, 2011, 08:15:55 AM
 #2

I asked mods to have a look into it. Fingers crossed.

-
error
Hero Member
*****
Offline Offline

Activity: 574



View Profile
June 11, 2011, 08:17:29 AM
 #3

Looks like you have a single / after bitcoin: . That isn't going to work.

15UFyv6kfWgq83Pp3yhXPr8rknv9m6581W
error
Hero Member
*****
Offline Offline

Activity: 574



View Profile
June 11, 2011, 02:43:30 PM
 #4

Yes, but the URI scheme has NO slashes.

15UFyv6kfWgq83Pp3yhXPr8rknv9m6581W
error
Hero Member
*****
Offline Offline

Activity: 574



View Profile
June 11, 2011, 03:02:14 PM
 #5

The bitcoin: URI scheme is not supposed to have any slashes at all, since nothing in Bitcoin is an Internet address or hostname.

15UFyv6kfWgq83Pp3yhXPr8rknv9m6581W
hamdi
Hero Member
*****
Offline Offline

Activity: 644



View Profile
June 11, 2011, 03:19:25 PM
 #6

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

error
Hero Member
*****
Offline Offline

Activity: 574



View Profile
June 11, 2011, 03:34:42 PM
 #7

Sorry, I won't implement a non-RFC compliant URI scheme.

15UFyv6kfWgq83Pp3yhXPr8rknv9m6581W
error
Hero Member
*****
Offline Offline

Activity: 574



View Profile
June 11, 2011, 03:47:50 PM
 #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?

15UFyv6kfWgq83Pp3yhXPr8rknv9m6581W
error
Hero Member
*****
Offline Offline

Activity: 574



View Profile
June 11, 2011, 04: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?

15UFyv6kfWgq83Pp3yhXPr8rknv9m6581W
hamdi
Hero Member
*****
Offline Offline

Activity: 644



View Profile
June 11, 2011, 04: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...

generalunited
Newbie
*
Offline Offline

Activity: 14


View Profile
June 11, 2011, 04: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..
Luke-Jr
Legendary
*
Offline Offline

Activity: 2100



View Profile
June 11, 2011, 04: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' => '<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;
 

ThomasV
Legendary
*
Offline Offline

Activity: 1722



View Profile WWW
January 17, 2012, 02:00:08 PM
 #13

any progress on this?

Electrum: the convenience of a web wallet, without the risks
theymos
Administrator
Legendary
*
Offline Offline

Activity: 2506


View Profile
January 19, 2012, 05: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).

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
ThomasV
Legendary
*
Offline Offline

Activity: 1722



View Profile WWW
January 19, 2012, 06: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?

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.

Electrum: the convenience of a web wallet, without the risks
Luke-Jr
Legendary
*
Offline Offline

Activity: 2100



View Profile
January 19, 2012, 07: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:<address> case is unanimous.

piuk
Hero Member
*****
Offline Offline

Activity: 910



View Profile WWW
January 19, 2012, 02:05:19 PM
 #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.

piuk
Hero Member
*****
Offline Offline

Activity: 910



View Profile WWW
January 19, 2012, 02:10:11 PM
 #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+

ThomasV
Legendary
*
Offline Offline

Activity: 1722



View Profile WWW
January 19, 2012, 02:19:51 PM
 #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

Electrum: the convenience of a web wallet, without the risks
Luke-Jr
Legendary
*
Offline Offline

Activity: 2100



View Profile
January 19, 2012, 02:54:03 PM
 #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.

Pages: [1] 2 »  All
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!