From 2a818e866f580c39ea403aa6dc31d3a8a2617cf2 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 19 Dec 2011 09:35:24 +0100 Subject: [PATCH] uhremotestorage: update webfinger link --- uhremotestorage.tgz | Bin 1144 -> 1577 bytes uhremotestorage/settings.tpl | 3 ++ uhremotestorage/uhremotestorage.php | 47 +++++++++++++++++++++++----- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/uhremotestorage.tgz b/uhremotestorage.tgz index 2654cd0317dc7bf6f9d9a36f3c72aff73e08767c..5515aeaa531754c10a571fd30815fb825a7cd9a0 100644 GIT binary patch literal 1577 zcmV+^2G;o>iwFQv^zKdo1ML|7PuoV6Uz5M$%}Zwo1v@DPB<6TykhYV$b%K6OqR4Wb zOLB_i^Umi6hWOw2-kp;sDU{L{Hfespu>;e@octbawZ)clJ8FySp3h&h~ca$p-A)hcW9=JwfyfrMl`g)fq%Ec|2+TxPnhAlx4Bt|P53>U zvVADhvB(u0fT;v1OMwWESRPBBDK64|=$&UGXTVdS*ubC1N1(rt?|Bn0M^Y4-8;hxz zNipOJ^DupqpPx?yWcTV&hhdS%WGAdubjVZ8c#=3xxUAPC8*wyBhGQWnj-8<$0&Nb@ z<-l%%9SsH|UGItOdW4AA6|D$s{`j%7q!{ru%$ZU=9pzuGZz1S*T_I*peKUnd8fvZA z5-}Pv=~!iuG0SUA7Lr}n>-8JcgPC4RP`y^951ONo)!k>7Zqs(}c_PC1H)iR^BrS){ zX+$mfq0w(*J0<9g)1ZcLL4(@830)inSt16^v3|B%jqq9T)u~-bZl6&AG%eEPN`{hU zNfaYp6vt}cYFS85XiY~%e>v7k??vzM6%>2`Pmf>zW+u1>5z{cB5kdQ(Z&-TVT@)NvgrIZ zA{}nJhEj2hH zoaRl9bf;w8)KGVe{tbgi|I*%%P*!l1U@3j9gq8 zZ7M={wvuR=YsB(iRP&;jMx2T3Ak^oGTHfeTSc7)s940iQ&G z&EY)Cn}kKfQx@Z5<+XdmGZ&nM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#1sTvD#4E-2SIV@zD@iw`4$8&OJ_N=kS}7YShA+;0m{ucG6er1<0B75T{B2ri=w z0^*v#WunYH$HPj}EO@meIzKJ+qYeV@mq15*wF%_>?Bhmjl~&YLXBa!i&(qrDMB-wB zsoR+B)C-$8fu`}AG6oZU)1z;pQc-ipLK^*ql^6yz3X(i8f;xE@O}E19I!}~tQd;uE z#k=>F*>Fb-797L=scH=J@5bS$?@O+ z|Bm}TeE$!IL-YQB6@(eRf|MmiF}ClxKbl}`Uf7Y<3g;(L-4??Df8s z;_E-frc79d@9Ml%x@@pNs5!K&*|Ba>uwJ92ZiOhkUZa+6qt&Ulqp;c!>Lw?fNzk2r zZ0FU5MHR8(Dq$tgwC@ChC=5_p)UxWY=?De}1_lNO1_lNO1_lNO1_lNO1_lNOh`#`5 K2XC+dC;$M|3@R4@ diff --git a/uhremotestorage/settings.tpl b/uhremotestorage/settings.tpl index 45036dd4d..22d7d6084 100644 --- a/uhremotestorage/settings.tpl +++ b/uhremotestorage/settings.tpl @@ -2,5 +2,8 @@

$title

$desc

{{ inc field_input.tpl with $field=$url }}{{ endinc }} + {{ inc field_input.tpl with $field=$auth }}{{ endinc }} + {{ inc field_select.tpl with $field=$api }}{{ endinc }}
+ diff --git a/uhremotestorage/uhremotestorage.php b/uhremotestorage/uhremotestorage.php index 5c1820042..3b8ab34c2 100644 --- a/uhremotestorage/uhremotestorage.php +++ b/uhremotestorage/uhremotestorage.php @@ -2,7 +2,7 @@ /** * Name: unhosted remote storage * Description: Expose in user XRD the link to external user's unhosted-enabled storage - * Version: 1.0 + * Version: 1.2 * Author: Fabio Comuni */ @@ -25,12 +25,19 @@ function uhremotestorage_uninstall() { } function uhremotestorage_personal_xrd($a, &$b){ + list($user, $host) = explode("@",$_GET['uri']); + $user = str_replace("acct:","",$user); + $r = q("SELECT uid FROM user WHERE nickname='%s'", dbesc($user)); + $uid = $r[0]['uid']; - $davurl = get_pconfig($b['user']['uid'],'uhremotestorage','davurl'); - if ($davurl){ + $url = get_pconfig($uid,'uhremotestorage','unhoestedurl'); + $auth = get_pconfig($uid,'uhremotestorage','unhoestedauth'); + $api = get_pconfig($uid,'uhremotestorage','unhoestedapi'); + + if ($url){ $b['xml'] = str_replace( '', - "\t".''."\n", + "\t".''."\n", $b['xml'] ); } @@ -39,7 +46,9 @@ function uhremotestorage_personal_xrd($a, &$b){ function uhremotestorage_settings_post($a, $post){ if(! local_user()) return; - set_pconfig(local_user(),'uhremotestorage','davurl',$_POST['unhoestedurl']); + set_pconfig(local_user(),'uhremotestorage','unhoestedurl',$_POST['unhoestedurl']); + set_pconfig(local_user(),'uhremotestorage','unhoestedauth',$_POST['unhoestedauth']); + set_pconfig(local_user(),'uhremotestorage','unhoestedapi',$_POST['unhoestedapi']); } function uhremotestorage_settings($a, &$s){ @@ -48,13 +57,35 @@ function uhremotestorage_settings($a, &$s){ $uid = $a->user['nickname'] ."@". $a->get_hostname(); - $davurl = get_pconfig(local_user(),'uhremotestorage','davurl'); + $url = get_pconfig(local_user(),'uhremotestorage','unhoestedurl'); + $auth = get_pconfig(local_user(),'uhremotestorage','unhoestedauth'); + $api = get_pconfig(local_user(),'uhremotestorage','unhoestedapi'); + + $arr_api = array( + 'WebDAV' => "WebDAV", + 'simple' => "simple WebDAV", + 'CouchDB' => "CouchDB", + ); + /* experimental apis */ + /* + $api = array_merge($api, array( + 'git' => "git", + 'tahoe-lafs' => 'tahoe-lafs', + 'camlistore' => 'camlistore', + 'AmazonS3' => 'AmazonS3', + 'GoogleDocs' => 'GoogleDocs', + 'Dropbox' => 'Dropbox', + ); + */ $tpl = file_get_contents(dirname(__file__)."/settings.tpl"); $s .= replace_macros($tpl, array( '$title' => 'Unhosted remote storage', - '$desc' => sprintf( t('Allow to use your friendika id (%s) to connecto to external unhosted-enabled storage (like ownCloud)'), $uid ), - '$url' => array( 'unhoestedurl', t('Unhosted DAV storage url'), $davurl, 'If your are using ownCloud, your unhosted url will be like http://HOST/apps/remoteStorage/compat.php/USER/remoteStorage/'), + '$desc' => sprintf( t('Allow to use your friendika id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See RemoteStorage WebFinger'), $uid ), + '$url' => array( 'unhoestedurl', t('Template URL (with {category})'), $url, 'If your are using ownCloud, your unhosted url will be like http://HOST/apps/remoteStorage/WebDAV.php/USER/remoteStorage/{category}'), + '$auth' => array( 'unhoestedauth', t('OAuth end-point'), $auth, 'If your are using ownCloud, your OAuth endpoint will be like http://HOST/apps/remoteStorage/auth.php/USER'), + '$api' => array( 'unhoestedapi', t('Api'), $api, 'If your are using ownCloud, your api will be WebDAV', $arr_api), + '$submit' => t('Submit'), ));