Sharing only supported for *.subsonic.org domains?

Need help? Post your questions here.

Moderator: moderators

Sharing only supported for *.subsonic.org domains?

Postby eblade » Tue Dec 27, 2011 3:46 pm

"Sharing is only supported for *.subsonic.org domain names." . . . why is this?
eblade
 
Posts: 66
Joined: Wed Nov 30, 2011 9:01 pm

Re: Sharing only supported for *.subsonic.org domains?

Postby BKKKPewsey » Tue Dec 27, 2011 6:19 pm

Read http://forum.subsonic.org/forum/viewtopic.php?f=8&t=7599&hilit=share

and Sindre's TODO List "Support custom domain name in sharing (Settings > Advanced)"


:mrgreen:
Everyone is entitled to be stupid, Image but some abuse the privilege!

Due to the confusion from too many genres of music, we have decided to put both country music and rap music into the genre of Crap music.
User avatar
BKKKPewsey
 
Posts: 2080
Joined: Mon May 23, 2011 12:16 pm
Location: United Kingdom

Re: Sharing only supported for *.subsonic.org domains?

Postby eblade » Tue Dec 27, 2011 6:54 pm

i... see. well, i don't have my own DNS provider for no reason at all.. so, well, i guess that's a feature that isn't getting implemented into my client to start with. oh well :)
eblade
 
Posts: 66
Joined: Wed Nov 30, 2011 9:01 pm

Re: Sharing only supported for *.subsonic.org domains?

Postby ytechie » Tue Jan 03, 2012 5:15 pm

Here is how to use a custom domain for sharing without redoing your entire subsonic setup. Note that this will disable the subsonic.org domain for sharing and will prevent you from using one in the future.

There is a fair amount of editing involved, so be prepared. :D

We are going to be editing the file createShare.jsp which is located in the WEB-INF directory.

I wrote a script that is pretty simple, yet it does exactly what we need done. It takes the url provided, and splits it into two parts. The first part is everything before and including "http://[you].[subsonic.org]/share/" and the second part is everything after that, which ends up being the unique share identifier.

Here is the script:

Code: Select all
<script type="text/javascript">
function splitUrl() {
var fullUrl = ' ${model.playUrl}';
var url = fullUrl.split("share/");
document.getElementById('facebookLink').href = 'http://www.facebook.com/sharer.php?u=' + 'http://[customUrl]/share/' + url[1];
document.getElementById('twitterLink').href = 'http://twitter.com/?status=Listening to ' + 'http://[customUrl]/share/' + url[1];
document.getElementById('link').href = 'http://[customUrl]/share/' + url[1];
document.getElementById('link').innerHTML = 'http://[customUrl]/share/' + url[1];
}
</script>


[customUrl] is a placeholder for this example, and you should replace it with the url of your choice (do not include the brackets.)

Now we have to specify that this script should run when the page loads. Add "onload="splitUrl()" to the body tag as I did below:

Code: Select all
<body class="mainframe bgcolor1" onload="splitUrl()">


Now we have to clear out the statements that check whether or not a subsonic.org address is being used as specified in the network settings.

To do that, you will want to remove the <c:choose>, <c:when> and <c:otherwise> start and end tags.

Optional: Clear out the urls of the Facebook and Twitter links since they will be repopulated by our nifty script.

Now add the proper IDs to the link tags. The Facebook ID should be id="facebookLink" and the Twitter ID should be id="twitterLink".

We also have to replace the share link message at the bottom with a span.

Here is what the final result should look like without the script:

Code: Select all
<h1><fmt:message key="share.title"/></h1>
        <fmt:message key="share.warning"/>
        <p>
            <img src="<spring:theme code="shareFacebookImage"/>" alt="">&nbsp;<a id="facebookLink"
                href="" target="_blank"><fmt:message key="share.facebook"/></a>
        </p>
        <p>
            <img src="<spring:theme code="shareTwitterImage"/>" alt="">&nbsp;<a id="twitterLink"
                href="" target="_blank"><fmt:message key="share.twitter"/></a>
        </p>
        <p>
            <span>Or share this with someone by sending them this link: <a id="link" href="" target="_blank"></a></span>
        </p>


Make sure to add the script, and you should now be able to share using a custom domain!

Enjoy!
User avatar
ytechie
 
Posts: 547
Joined: Sun Dec 12, 2010 5:05 am
Location: Manhattan, New York


Return to Help

Who is online

Users browsing this forum: No registered users and 18 guests