@ -37,6 +37,7 @@ import java.util.HashMap;
import java.util.Iterator ;
import java.util.Locale ;
import java.util.Map ;
import java.util.Set ;
import net.yacy.cora.document.encoding.UTF8 ;
import net.yacy.cora.protocol.Domains ;
@ -127,6 +128,18 @@ public class Wiki {
prop . putHTML ( serverObjects . ACTION_LOCATION , "/Wiki.html?page=" + pagename ) ;
prop . put ( serverObjects . ACTION_LOCATION , prop . get ( serverObjects . ACTION_LOCATION ) ) ;
}
String hostAndPort = null ;
Set < String > ips = null ;
if ( sb . peers . mySeed ( ) ! = null ) {
ips = sb . peers . mySeed ( ) . getIPs ( ) ;
}
if ( ips ! = null & & ! ips . isEmpty ( ) ) {
hostAndPort = sb . peers . mySeed ( ) . getPublicAddress ( ips . iterator ( ) . next ( ) ) ;
}
if ( hostAndPort = = null ) {
hostAndPort = Domains . LOCALHOST + ":" + sb . getLocalPort ( ) ;
}
if ( post ! = null & & post . containsKey ( "edit" ) ) {
if ( ( access . equals ( "admin" ) & & ( ! sb . verifyAuthentication ( header ) ) ) ) {
@ -147,7 +160,8 @@ public class Wiki {
prop . putHTML ( "mode_pagename" , pagename ) ;
prop . putHTML ( "mode_author" , author ) ;
prop . put ( "mode_date" , dateString ( new Date ( ) ) ) ;
prop . putWiki ( sb . peers . mySeed ( ) . getPublicAddress ( sb . peers . mySeed ( ) . getIP ( ) ) , "mode_page" , post . get ( "content" , "" ) ) ;
// Note : it would be better to not only pass the peer host and port but also the protocol (http or https)
prop . putWiki ( hostAndPort , "mode_page" , post . get ( "content" , "" ) ) ;
prop . putHTML ( "mode_page-code" , post . get ( "content" , "" ) ) ;
}
//end contrib of [MN]
@ -237,7 +251,7 @@ public class Wiki {
prop . putHTML ( "mode_versioning_pagename" , pagename ) ;
prop . putHTML ( "mode_versioning_author" , oentry . author ( ) ) ;
prop . put ( "mode_versioning_date" , dateString ( oentry . date ( ) ) ) ;
prop . putWiki ( sb. peers . mySeed ( ) . getPublicAddress ( sb . peers . mySeed ( ) . getIP ( ) ) , "mode_versioning_page" , oentry . page ( ) ) ;
prop . putWiki ( hostAndPort , "mode_versioning_page" , oentry . page ( ) ) ;
prop . putHTML ( "mode_versioning_page-code" , UTF8 . String ( oentry . page ( ) ) ) ;
}
} catch ( final IOException e ) {
@ -252,7 +266,7 @@ public class Wiki {
prop . putHTML ( "mode_pagename" , pagename ) ;
prop . putHTML ( "mode_author" , page . author ( ) ) ;
prop . put ( "mode_date" , dateString ( page . date ( ) ) ) ;
prop . putWiki ( sb. peers . mySeed ( ) . getPublicAddress ( sb . peers . mySeed ( ) . getIP ( ) ) , "mode_page" , page . page ( ) ) ;
prop . putWiki ( hostAndPort , "mode_page" , page . page ( ) ) ;
prop . put ( "controls" , "0" ) ;
prop . putHTML ( "controls_pagename" , pagename ) ;