mirror of
https://github.com/fergalmoran/dss.web.git
synced 2026-02-15 04:25:41 +00:00
Merge tag 'share_links' into develop
Fixed
This commit is contained in:
@@ -38,14 +38,15 @@
|
||||
"smalot-bootstrap-datetimepicker": "~2.3.4",
|
||||
"js-data-angular": "~3.1.0",
|
||||
"ui-select": "angular-ui-select#~0.13.2",
|
||||
"ngInfiniteScroll": "~1.2.1"
|
||||
"ngInfiniteScroll": "~1.2.1",
|
||||
"zeroclipboard": "~2.2.0",
|
||||
"ng-clip": "~0.2.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"angular-mocks": ">=1.2.*",
|
||||
"angular-scenario": ">=1.2.*"
|
||||
},
|
||||
"resolutions": {
|
||||
"js-data-angular": "~3.1.0",
|
||||
"angular-bootstrap": "~0.14.3",
|
||||
"angular": "1.4.8"
|
||||
}
|
||||
|
||||
@@ -48,10 +48,15 @@ angular.module('dssWebApp')
|
||||
{size: 'md'});
|
||||
};
|
||||
$scope.shareFacebook = function () {
|
||||
helpers.social.postToFacebook($scope.mix);
|
||||
helpers.social.postToFacebook(
|
||||
$scope.mix.title,
|
||||
$scope.mix.mix_image,
|
||||
$scope.mix.description,
|
||||
$state.href('root.user.mix', {user: $scope.mix.user.slug, mix: $scope.mix.slug})
|
||||
);
|
||||
};
|
||||
$scope.shareTwitter = function () {
|
||||
helpers.social.postToTwitter($scope.mix);
|
||||
helpers.social.postToTwitter($state.href('root.user.mix', {user: $scope.mix.user.slug, mix: $scope.mix.slug}));
|
||||
};
|
||||
$scope.toggleFollow = function () {
|
||||
if ($scope.currentUser) {
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
var helpers = helpers || {};
|
||||
function _getLink(url){
|
||||
return window.location.protocol + "//" + (window.location.host + '/' + url).replace(/([^:]\/)\/+/g, '$1');
|
||||
}
|
||||
|
||||
if (FB) {
|
||||
FB.init({
|
||||
appId: '154504534677009',
|
||||
@@ -9,17 +13,17 @@ if (FB) {
|
||||
});
|
||||
}
|
||||
helpers.social = {
|
||||
postToFacebook: function (mix) {
|
||||
postToFacebook: function (title, image, description, url) {
|
||||
FB.getLoginStatus(function (oResponse) {
|
||||
if (oResponse.status === "connected") {
|
||||
return FB.ui({
|
||||
method: "feed",
|
||||
name: "Check out this mix on Deep South Sounds",
|
||||
display: "iframe",
|
||||
link: "http://" + window.location.host + "/mixes/" + mix.slug,
|
||||
picture: mix.mix_image,
|
||||
caption: mix.title,
|
||||
description: mix.description
|
||||
link: _getLink(url),
|
||||
picture: _getLink(image),
|
||||
caption: title,
|
||||
description: description
|
||||
}, function (response) {
|
||||
if (response && response.post_id) {
|
||||
return utils.showAlert("Success", "Post shared to facebook");
|
||||
|
||||
@@ -110,10 +110,11 @@ angular.module('dssWebApp')
|
||||
var _processResult = function (result) {
|
||||
$scope.mix = result;
|
||||
$timeout(function () {
|
||||
var url = $state.href('root.user.mix', {user: $scope.mix.user.slug, mix: $scope.mix.slug});
|
||||
$scope.waveformFooter = "Waveform processing is taking longer than expected.<br />" +
|
||||
"Your mix should be available <a ui-sref='root.user.mix({user: currentUser.slug, mix: mix.slug})'>Here</a>";
|
||||
"Your mix should be available <a href='" + url + "'>Here</a>";
|
||||
$scope.$apply();
|
||||
}, 120000);
|
||||
}, 1200);
|
||||
|
||||
var imageFile = document.getElementById('mix-image-fileinput').files[0];
|
||||
if (imageFile) {
|
||||
|
||||
@@ -123,6 +123,8 @@
|
||||
<script src="bower_components/js-data-angular/dist/js-data-angular.js"></script>
|
||||
<script src="bower_components/ui-select/dist/select.js"></script>
|
||||
<script src="bower_components/ngInfiniteScroll/build/ng-infinite-scroll.js"></script>
|
||||
<script src="bower_components/zeroclipboard/dist/ZeroClipboard.js"></script>
|
||||
<script src="bower_components/ng-clip/src/ngClip.js"></script>
|
||||
<!-- endbower -->
|
||||
<script src="socket.io-client/socket.io.js"></script>
|
||||
<!-- endbuild -->
|
||||
|
||||
@@ -1,7 +1,19 @@
|
||||
'use strict';
|
||||
var errors = require('./components/errors');
|
||||
var http = require('http');
|
||||
var url = require('url');
|
||||
function _parseUrl(u){
|
||||
var parts = url.parse(u, true, true);
|
||||
|
||||
var path = parts.pathname.split('/').filter(function(arg){
|
||||
return arg;
|
||||
});
|
||||
if (path.length == 2){
|
||||
//probably a mix, reconstruct url and return
|
||||
return parts.protocol + "//" + parts.host + "/mix/" + path[1] + "/";
|
||||
}
|
||||
return u;
|
||||
}
|
||||
module.exports = function (app) {
|
||||
|
||||
app.route('/config')
|
||||
@@ -21,7 +33,7 @@ module.exports = function (app) {
|
||||
app.route('/*')
|
||||
.get(function (req, res) {
|
||||
if (req.headers['user-agent'].indexOf('facebookexternalhit') > -1) {
|
||||
var url = (app.get('apiUrl') + req.path + '/').replace(/([^:]\/)\/+/g, "$1");
|
||||
var url = _parseUrl((app.get('apiUrl') + req.path + '/').replace(/([^:]\/)\/+/g, "$1"));
|
||||
console.log('Api url: ' + url);
|
||||
http.get(url, function (api_res) {
|
||||
var body = '';
|
||||
@@ -29,7 +41,7 @@ module.exports = function (app) {
|
||||
body += chunk;
|
||||
});
|
||||
api_res.on('end', function() {
|
||||
res.render('social/facebook/mix', JSON.parse(body));
|
||||
res.render('social/facebook/mix', JSON.parse(body));
|
||||
});
|
||||
}).on('error', function (e) {
|
||||
console.log("Got error: " + e.message);
|
||||
|
||||
Reference in New Issue
Block a user