web/satellite: use config value for linksharing

WHAT:
use config value for linksharing instead of harded one

WHY:
better testing

Change-Id: I16fdb5b23198716b76d5332a1113daaa0eb86030
This commit is contained in:
Vitalii Shpital 2021-04-09 14:56:21 +03:00
parent a3e6604883
commit b907aab0ad
4 changed files with 12 additions and 2 deletions

View File

@ -89,6 +89,7 @@ type Config struct {
CouponCodeUIEnabled bool `help:"indicates if user is allowed to add coupon codes to account" default:"false"` CouponCodeUIEnabled bool `help:"indicates if user is allowed to add coupon codes to account" default:"false"`
FileBrowserFlowDisabled bool `help:"indicates if file browser flow is disabled" default:"true"` FileBrowserFlowDisabled bool `help:"indicates if file browser flow is disabled" default:"true"`
CSPEnabled bool `help:"indicates if Content Security Policy is enabled" devDefault:"false" releaseDefault:"true"` CSPEnabled bool `help:"indicates if Content Security Policy is enabled" devDefault:"false" releaseDefault:"true"`
LinksharingURL string `help:"url link for linksharing requests" default:"https://link.tardigradeshare.io"`
RateLimit web.IPRateLimiterConfig RateLimit web.IPRateLimiterConfig
@ -315,6 +316,7 @@ func (server *Server) appHandler(w http.ResponseWriter, r *http.Request) {
DocumentationURL string DocumentationURL string
CouponCodeUIEnabled bool CouponCodeUIEnabled bool
FileBrowserFlowDisabled bool FileBrowserFlowDisabled bool
LinksharingURL string
} }
data.ExternalAddress = server.config.ExternalAddress data.ExternalAddress = server.config.ExternalAddress
@ -334,6 +336,7 @@ func (server *Server) appHandler(w http.ResponseWriter, r *http.Request) {
data.DocumentationURL = server.config.DocumentationURL data.DocumentationURL = server.config.DocumentationURL
data.CouponCodeUIEnabled = server.config.CouponCodeUIEnabled data.CouponCodeUIEnabled = server.config.CouponCodeUIEnabled
data.FileBrowserFlowDisabled = server.config.FileBrowserFlowDisabled data.FileBrowserFlowDisabled = server.config.FileBrowserFlowDisabled
data.LinksharingURL = server.config.LinksharingURL
if server.templates.index == nil { if server.templates.index == nil {
server.log.Error("index template is not set") server.log.Error("index template is not set")

View File

@ -127,6 +127,9 @@ compensation.withheld-percents: 75,75,75,50,50,50,25,25,25,0,0,0,0,0,0
# url link to let us know page # url link to let us know page
# console.let-us-know-url: https://storjlabs.atlassian.net/servicedesk/customer/portals # console.let-us-know-url: https://storjlabs.atlassian.net/servicedesk/customer/portals
# url link for linksharing requests
# console.linksharing-url: https://link.tardigradeshare.io
# enable open registration # enable open registration
# console.open-registration-enabled: false # console.open-registration-enabled: false

View File

@ -20,6 +20,7 @@
<meta name="documentation-url" content="{{ .DocumentationURL }}"> <meta name="documentation-url" content="{{ .DocumentationURL }}">
<meta name="coupon-code-ui-enabled" content="{{ .CouponCodeUIEnabled }}"> <meta name="coupon-code-ui-enabled" content="{{ .CouponCodeUIEnabled }}">
<meta name="file-browser-flow-disabled" content="{{ .FileBrowserFlowDisabled }}"> <meta name="file-browser-flow-disabled" content="{{ .FileBrowserFlowDisabled }}">
<meta name="linksharing-url" content="{{ .LinksharingURL }}">
<title>{{ .SatelliteName }}</title> <title>{{ .SatelliteName }}</title>
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAL8SURBVHgBxVcxTFNRFL01JvylrRsmNWETWWSybg5I3NTQBCdRFyfrDuoKMgMyOQgdTcDAJmrUrWWCgQIbhJKy0TJQpsc73P/S9/tfP+8/GnqSn1fo77/3nnPufe8nhAR1ETeoy7hJjpj93/ycu0+UuUVuEA5Y2xaifirEVpX/nvknnBFbgpMGUfmIKOkRLRT578oxXy6IJcFCialH0EyaaPoZBy7tEQ3NEY1IKd4/iidHwqYLijLA559cuY6dT0RjBU5AAYm9fiivLFnBKMGBTyeqQ4BXhXDwdqjUiKZkskOzREsbzeeBNRMCEiDgr12uYl1WNbnW/oc2iUys8jrQyyxhHRkM3hdgAMFBHQyGG/GDqyDlsSeS/npQC99jlEBpOnyX2XCF8sGhZLbeMLMZkCDbJ1nYYTfDeMP9fMH5y5vmIKYE8RxUjBXPedDH1Zu6I9QFSzLQxErz4Xn5oNwg+2NSmuv3Lkvz4QlTi8rupDlBmA6tqQLrnYNCvoxSNAOtUEaakwzMv+ALidTP2OlKKiSK75Cs6hy9NYFkjzmG1SBCIuUq0Za8pgydge8R9E+e10qNrGE1ikH5435mo11bQgr4B9LEgVUC0Npm1o+vcuvBxB1NYFsaaeC2XUuW/Xs7msC9Xqa+MMa9jQr1KtXAQoKYHakeskbIhDrVasdTbbVY4s8ZYld/9PWuyeTSHksFBjBFcZ+aH/j/yZk5gcAcgImgIX6MNsKKhKBta1sB2A3HV5pD6iJQIzw/MICwoohc1F6ALBH03XemFYPl+VdzcBNUh6j5gZZEcP341opAAnX/AXl/A0FlrrshgMRR+YUvPPN8CHgAxlqWVYuEdH7V/ZilA6cosFDa53EcmUDKC+7X+IwxHEVhO0DK6aeXH88uHcWQA8xE7Yg69M6xgdWZUEFtNNDyx1s2KnyDIxu22zdZTjgWhANm/vL6clGIsnw3+Fbk94RreS8AMGrBxvwoT0lMPnSNC2JJoAPdgnMBJLjKq5lzAp1C19+OzwFiYzAU5f7eeQAAAABJRU5ErkJggg==" type="image/x-icon"> <link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAL8SURBVHgBxVcxTFNRFL01JvylrRsmNWETWWSybg5I3NTQBCdRFyfrDuoKMgMyOQgdTcDAJmrUrWWCgQIbhJKy0TJQpsc73P/S9/tfP+8/GnqSn1fo77/3nnPufe8nhAR1ETeoy7hJjpj93/ycu0+UuUVuEA5Y2xaifirEVpX/nvknnBFbgpMGUfmIKOkRLRT578oxXy6IJcFCialH0EyaaPoZBy7tEQ3NEY1IKd4/iidHwqYLijLA559cuY6dT0RjBU5AAYm9fiivLFnBKMGBTyeqQ4BXhXDwdqjUiKZkskOzREsbzeeBNRMCEiDgr12uYl1WNbnW/oc2iUys8jrQyyxhHRkM3hdgAMFBHQyGG/GDqyDlsSeS/npQC99jlEBpOnyX2XCF8sGhZLbeMLMZkCDbJ1nYYTfDeMP9fMH5y5vmIKYE8RxUjBXPedDH1Zu6I9QFSzLQxErz4Xn5oNwg+2NSmuv3Lkvz4QlTi8rupDlBmA6tqQLrnYNCvoxSNAOtUEaakwzMv+ALidTP2OlKKiSK75Cs6hy9NYFkjzmG1SBCIuUq0Za8pgydge8R9E+e10qNrGE1ikH5435mo11bQgr4B9LEgVUC0Npm1o+vcuvBxB1NYFsaaeC2XUuW/Xs7msC9Xqa+MMa9jQr1KtXAQoKYHakeskbIhDrVasdTbbVY4s8ZYld/9PWuyeTSHksFBjBFcZ+aH/j/yZk5gcAcgImgIX6MNsKKhKBta1sB2A3HV5pD6iJQIzw/MICwoohc1F6ALBH03XemFYPl+VdzcBNUh6j5gZZEcP341opAAnX/AXl/A0FlrrshgMRR+YUvPPN8CHgAxlqWVYuEdH7V/ZilA6cosFDa53EcmUDKC+7X+IwxHEVhO0DK6aeXH88uHcWQA8xE7Yg69M6xgdWZUEFtNNDyx1s2KnyDIxu22zdZTjgWhANm/vL6clGIsnw3+Fbk94RreS8AMGrBxvwoT0lMPnSNC2JJoAPdgnMBJLjKq5lzAp1C19+OzwFiYzAU5f7eeQAAAABJRU5ErkJggg==" type="image/x-icon">
<link rel="dns-prefetch" href="https://js.stripe.com"> <link rel="dns-prefetch" href="https://js.stripe.com">

View File

@ -22,6 +22,7 @@ import { MetaUtils } from '@/utils/meta';
}, },
}) })
export default class UploadFile extends Vue { export default class UploadFile extends Vue {
private linksharingURL = '';
private worker: Worker; private worker: Worker;
/** /**
@ -46,6 +47,8 @@ export default class UploadFile extends Vue {
return; return;
} }
this.linksharingURL = MetaUtils.getMetaContent('linksharing-url');
this.setWorker(); this.setWorker();
} }
@ -80,7 +83,7 @@ export default class UploadFile extends Vue {
try { try {
const key: string = await this.accessKey(this.apiKey, inADay, path); const key: string = await this.accessKey(this.apiKey, inADay, path);
return `https://link.tardigradeshare.io/s/${key}/${path}?map=1`; return `${this.linksharingURL}/s/${key}/${path}?map=1`;
} catch (error) { } catch (error) {
await this.$notify.error(error.message); await this.$notify.error(error.message);
@ -101,7 +104,7 @@ export default class UploadFile extends Vue {
try { try {
const key: string = await this.accessKey(cleanAPIKey.secret, notAfter, path); const key: string = await this.accessKey(cleanAPIKey.secret, notAfter, path);
return `https://link.tardigradeshare.io/${key}/${path}`; return `${this.linksharingURL}/${key}/${path}`;
} catch (error) { } catch (error) {
await this.$notify.error(error.message); await this.$notify.error(error.message);