Skip to content

Commit

Permalink
Fix for #20
Browse files Browse the repository at this point in the history
  • Loading branch information
Dick committed Dec 14, 2020
1 parent df32fbc commit f18618a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/api_client/apiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ function listener() {
}

export var serverAddress = ""
// This is a dirty hack. Grabs current host for when sharing. URL handling needs cleaned up. DW 12-13-20
export var shareAddress = window.location.host

export var Server = axios.create({
baseURL: '/api/',
Expand Down Expand Up @@ -56,4 +58,4 @@ Server.interceptors.response.use(function (response) {
return Promise.reject(error);
});

export default {serverAddress, Server}
export default {serverAddress, Server, shareAddress}
7 changes: 5 additions & 2 deletions src/components/lightBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
Transition,
Breadcrumb
} from "semantic-ui-react";
import { Server, serverAddress } from "../api_client/apiClient";
import { Server, serverAddress, shareAddress } from "../api_client/apiClient";
import LazyLoad from "react-lazyload";
import Lightbox from "react-image-lightbox";
import { LocationMap } from "../components/maps";
Expand Down Expand Up @@ -267,7 +267,10 @@ export class LightBox extends Component {
const val = !this.props.photoDetails[image_hash].public;
this.props.dispatch(setPhotosPublic([image_hash], val));
copyToClipboard(
serverAddress.replace('//','') + "/media/thumbnails_big/" + image_hash + ".jpg"
//edited from serverAddress.replace('//','') + "/media/thumbnails_big/" + image_hash + ".jpg"
// as above removed the domain and just left /media/thumbnails_big/" + image_hash + ".jpg" *DW 12/9/20
// Not location of shared photo link Reverted to orgiinal *DW 12/13/20
shareAddress + "/media/thumbnails_big/" + image_hash + ".jpg"
);
}}
color="black"
Expand Down
10 changes: 8 additions & 2 deletions src/layouts/ReusablePhotoListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import {
Breadcrumb
} from "semantic-ui-react";

import { Server, serverAddress } from "../api_client/apiClient";
import { Server, serverAddress, shareAddress } from "../api_client/apiClient";
import { LightBox } from "../components/lightBox";
import { LightBoxV2 } from "../components/LightBoxV2";
import LazyLoad from "react-lazyload";
Expand Down Expand Up @@ -500,8 +500,14 @@ export class PhotoListView extends Component {
this.props.dispatch(
setPhotosPublic([cell.image_hash], true)
);
// Location of generated link when shareing from album.
//Origianl was
//serverAddress.replace('//','') +
// "/media/reusableline505/" +
// cell.image_hash +
// ".jpg" DW 12-13-20
copyToClipboard(
serverAddress.replace('//','') +
shareAddress +
"/media/photos/" +
cell.image_hash +
".jpg"
Expand Down

0 comments on commit f18618a

Please sign in to comment.