diff --git a/R/figure.R b/R/figure.R index 37a62cfb4c..a9ba3c0424 100644 --- a/R/figure.R +++ b/R/figure.R @@ -18,7 +18,7 @@ get_figure <- function(username, id) { if (missing(username)) username <- verify("username") if (missing(id)) stop("Please provide a figure id number") - base_url <- file.path(get_domain(), "apigetfile", username, id) + base_url <- file.path("https://plot.ly/apigetfile", username, id) resp <- httr::GET(base_url, plotly_headers(), httr::config(ssl_verifypeer=FALSE)) process(struct(resp, "figure")) } diff --git a/R/plotly_IMAGE.R b/R/plotly_IMAGE.R index 44042539c8..d6fad7a00c 100644 --- a/R/plotly_IMAGE.R +++ b/R/plotly_IMAGE.R @@ -32,7 +32,7 @@ plotly_IMAGE <- function(x, width = 1000, height = 500, format = "png", scale = scale, encoded = FALSE ) - base_url <- paste0(get_domain("v2"), "images") + base_url <- file.path(get_domain("api"), "v2", "images") resp <- httr::POST(base_url, plotly_headers("v2"), body = to_JSON(bod), if (!missing(out_file)) write_disk(out_file, overwrite = TRUE), ...) diff --git a/R/plotly_POST.R b/R/plotly_POST.R index eb9c41c5b7..80efc117b2 100644 --- a/R/plotly_POST.R +++ b/R/plotly_POST.R @@ -71,13 +71,14 @@ plotly_POST <- function(x, filename, fileopt = "new", args = to_JSON(x$data), kwargs = to_JSON(x[get_kwargs()]) ) - base_url <- file.path(get_domain(), "clientresp") + base_url <- "https://plot.ly/clientresp" resp <- httr::POST(base_url, body = bod) con <- process(struct(resp, "clientresp")) if (sharing[1] == "hidden") { bits <- strsplit(con$url, "/")[[1]] plot_id <- bits[length(bits)] - url <- paste0(get_domain("v2"), "files/", verify("username"), ":", plot_id) + url <- file.path(get_domain("api"), "v2", "files", + paste0(verify("username"), ":", plot_id)) bod <- list(share_key_enabled = TRUE) con2 <- httr::PATCH(url, plotly_headers("v2"), body = bod, encode = "json") con$url <- paste0(con$url, "?share_key=", content(con2)$share_key) diff --git a/R/signup.R b/R/signup.R index 2d8f5051a3..838f3b0339 100644 --- a/R/signup.R +++ b/R/signup.R @@ -43,7 +43,7 @@ signup <- function(username, email, save = TRUE) { platform = "R", version = as.character(packageVersion("plotly")) ) - base_url <- file.path(get_domain(), "apimkacct") + base_url <- "https://plot.ly/apimkacct" resp <- httr::POST(base_url, body = bod) con <- process(struct(resp, "signup")) if (save) { diff --git a/R/utils.R b/R/utils.R index ae502809ee..a5095c0581 100644 --- a/R/utils.R +++ b/R/utils.R @@ -183,11 +183,9 @@ struct <- function(x, y, ...) { } # TODO: what are some other common configuration options we want to support?? -get_domain <- function(type = "main") { - if (type == "stream") { - Sys.getenv("plotly_streaming_domain", "http://stream.plot.ly") - } else if (type == "v2") { - Sys.getenv("plotly_domain", "https://api.plot.ly/v2/") +get_domain <- function(type = "") { + if (type == "api") { + Sys.getenv("plotly_api_domain", "https://api.plot.ly") } else { Sys.getenv("plotly_domain", "https://plot.ly") } diff --git a/man/plotly_POST.Rd b/man/plotly_POST.Rd index e68f806b91..9e5759c552 100644 --- a/man/plotly_POST.Rd +++ b/man/plotly_POST.Rd @@ -5,7 +5,7 @@ \title{Create/Modify plotly graphs} \usage{ plotly_POST(x, filename, fileopt = "new", sharing = c("public", "private", - "secret")) + "hidden")) } \arguments{ \item{x}{either a ggplot object, a plotly object, or a list.} @@ -27,7 +27,7 @@ Plotly feed, your profile, or search engines. You must be logged in to Plotly to view this graph. You can privately share this graph with other Plotly users in your online Plotly account and they will need to be logged in to view this plot. -If 'secret', anyone with this secret link can view this chart. It will +If 'hidden', anyone with this hidden link can view this chart. It will not appear in the Plotly feed, your profile, or search engines. If it is embedded inside a webpage or an IPython notebook, anybody who is viewing that page will be able to view the graph.