mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-11 07:58:11 -05:00
Compare commits
1 Commits
v0.14
...
feature/sh
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
762a23341f |
22
R/run-url.R
22
R/run-url.R
@@ -9,8 +9,9 @@
|
||||
#' @param port The TCP port that the application should listen on. Defaults to
|
||||
#' choosing a random port.
|
||||
#' @param launch.browser If true, the system's default web browser will be
|
||||
#' launched automatically after the app is started. Defaults to true in
|
||||
#' interactive sessions only.
|
||||
#' launched automatically after the app is started. Defaults to \code{"auto"},
|
||||
#' which uses the \code{shiny.launch.browser} preference if present, and
|
||||
#' invokes the browser specified by \code{shiny.browser} if specified.
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
@@ -24,8 +25,7 @@
|
||||
#' @export
|
||||
runGist <- function(gist,
|
||||
port=NULL,
|
||||
launch.browser=getOption('shiny.launch.browser',
|
||||
interactive())) {
|
||||
launch.browser="auto") {
|
||||
|
||||
gistUrl <- if (is.numeric(gist) || grepl('^[0-9a-f]+$', gist)) {
|
||||
sprintf('https://gist.github.com/%s/download', gist)
|
||||
@@ -54,8 +54,9 @@ runGist <- function(gist,
|
||||
#' @param port The TCP port that the application should listen on. Defaults to
|
||||
#' choosing a random port.
|
||||
#' @param launch.browser If true, the system's default web browser will be
|
||||
#' launched automatically after the app is started. Defaults to true in
|
||||
#' interactive sessions only.
|
||||
#' launched automatically after the app is started. Defaults to \code{"auto"},
|
||||
#' which uses the \code{shiny.launch.browser} preference if present, and
|
||||
#' invokes the browser specified by \code{shiny.browser} if specified.
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
@@ -68,7 +69,7 @@ runGist <- function(gist,
|
||||
#' @export
|
||||
runGitHub <- function(repo, username = getOption("github.user"),
|
||||
ref = "master", subdir = NULL, port = NULL,
|
||||
launch.browser = getOption('shiny.launch.browser', interactive())) {
|
||||
launch.browser = "auto") {
|
||||
|
||||
if (is.null(ref)) {
|
||||
stop("Must specify either a ref. ")
|
||||
@@ -104,8 +105,9 @@ runGitHub <- function(repo, username = getOption("github.user"),
|
||||
#' @param port The TCP port that the application should listen on. Defaults to
|
||||
#' choosing a random port.
|
||||
#' @param launch.browser If true, the system's default web browser will be
|
||||
#' launched automatically after the app is started. Defaults to true in
|
||||
#' interactive sessions only.
|
||||
#' launched automatically after the app is started. Defaults to \code{"auto"},
|
||||
#' which uses the \code{shiny.launch.browser} preference if present, and
|
||||
#' invokes the browser specified by \code{shiny.browser} if specified.
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
@@ -118,7 +120,7 @@ runGitHub <- function(repo, username = getOption("github.user"),
|
||||
#'
|
||||
#' @export
|
||||
runUrl <- function(url, filetype = NULL, subdir = NULL, port = NULL,
|
||||
launch.browser = getOption('shiny.launch.browser', interactive())) {
|
||||
launch.browser = "auto") {
|
||||
|
||||
if (!is.null(subdir) && ".." %in% strsplit(subdir, '/')[[1]])
|
||||
stop("'..' not allowed in subdir")
|
||||
|
||||
42
R/shiny.R
42
R/shiny.R
@@ -1392,9 +1392,11 @@ serviceApp <- function() {
|
||||
#' @param port The TCP port that the application should listen on. Defaults to
|
||||
#' choosing a random port.
|
||||
#' @param launch.browser If true, the system's default web browser will be
|
||||
#' launched automatically after the app is started. Defaults to true in
|
||||
#' interactive sessions only. This value of this parameter can also be a
|
||||
#' function to call with the application's URL.
|
||||
#' launched automatically after the app is started. Defaults to \code{"auto"},
|
||||
#' which uses the \code{shiny.launch.browser} preference if present, and
|
||||
#' invokes the browser specified by \code{shiny.browser} if specified. This
|
||||
#' value of this parameter can also be a function to call with the
|
||||
#' application's URL.
|
||||
#' @param host The IPv4 address that the application should listen on. Defaults
|
||||
#' to the \code{shiny.host} option, if set, or \code{"127.0.0.1"} if not. See
|
||||
#' Details.
|
||||
@@ -1431,8 +1433,7 @@ serviceApp <- function() {
|
||||
#' @export
|
||||
runApp <- function(appDir=getwd(),
|
||||
port=NULL,
|
||||
launch.browser=getOption('shiny.launch.browser',
|
||||
interactive()),
|
||||
launch.browser="auto",
|
||||
host=getOption('shiny.host', '127.0.0.1'),
|
||||
workerId="", quiet=FALSE,
|
||||
display.mode=c("auto", "normal", "showcase")) {
|
||||
@@ -1531,9 +1532,28 @@ runApp <- function(appDir=getwd(),
|
||||
|
||||
if (!is.character(port)) {
|
||||
appUrl <- paste("http://", host, ":", port, sep="")
|
||||
if (is.character(launch.browser) && identical(launch.browser, "auto")) {
|
||||
launch.browser <- getOption("shiny.launch.browser")
|
||||
if (is.null(launch.browser)) {
|
||||
# The user did not specify a browser to launch; check shiny.browser
|
||||
shiny.browser <- getOption("shiny.browser")
|
||||
if (!is.null(shiny.browser)) {
|
||||
if (is.function(shiny.browser))
|
||||
shiny.browser(appUrl, if (is.character(appDir)) appDir else "")
|
||||
else
|
||||
warning("The option shiny.browser is expected to be set to either ",
|
||||
"NULL or a function that takes a URL and path. No browser ",
|
||||
"will be launched.")
|
||||
} else {
|
||||
# No browser was specified in shiny.browser, either; launch the
|
||||
# system browser if we're interactive.
|
||||
launch.browser <- interactive()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is.function(launch.browser))
|
||||
launch.browser(appUrl)
|
||||
else if (launch.browser)
|
||||
else if (is.logical(launch.browser) && launch.browser)
|
||||
utils::browseURL(appUrl)
|
||||
} else {
|
||||
appUrl <- NULL
|
||||
@@ -1580,9 +1600,10 @@ stopApp <- function(returnValue = NULL) {
|
||||
#' list the available examples.
|
||||
#' @param port The TCP port that the application should listen on. Defaults to
|
||||
#' choosing a random port.
|
||||
#' @param launch.browser If true, the system's default web browser will be
|
||||
#' launched automatically after the app is started. Defaults to true in
|
||||
#' interactive sessions only.
|
||||
#' @param launch.browser If true, the system's default web browser will be
|
||||
#' launched automatically after the app is started. Defaults to \code{"auto"},
|
||||
#' which uses the \code{shiny.launch.browser} preference if present, and
|
||||
#' invokes the browser specified by \code{shiny.browser} if specified.
|
||||
#' @param host The IPv4 address that the application should listen on. Defaults
|
||||
#' to the \code{shiny.host} option, if set, or \code{"127.0.0.1"} if not.
|
||||
#' @examples
|
||||
@@ -1599,8 +1620,7 @@ stopApp <- function(returnValue = NULL) {
|
||||
#' @export
|
||||
runExample <- function(example=NA,
|
||||
port=NULL,
|
||||
launch.browser=getOption('shiny.launch.browser',
|
||||
interactive()),
|
||||
launch.browser="auto",
|
||||
host=getOption('shiny.host', '127.0.0.1')) {
|
||||
examplesDir <- system.file('examples', package='shiny')
|
||||
dir <- resolve(examplesDir, example)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
\title{Run Shiny Application}
|
||||
\usage{
|
||||
runApp(appDir = getwd(), port = NULL,
|
||||
launch.browser = getOption("shiny.launch.browser", interactive()),
|
||||
launch.browser = "auto",
|
||||
host = getOption("shiny.host", "127.0.0.1"),
|
||||
workerId = "", quiet = FALSE,
|
||||
display.mode = c("auto", "normal", "showcase"))
|
||||
@@ -19,9 +19,11 @@
|
||||
|
||||
\item{launch.browser}{If true, the system's default web
|
||||
browser will be launched automatically after the app is
|
||||
started. Defaults to true in interactive sessions only.
|
||||
This value of this parameter can also be a function to
|
||||
call with the application's URL.}
|
||||
started. Defaults to \code{"auto"}, which uses the
|
||||
\code{shiny.launch.browser} preference if present, and
|
||||
invokes the browser specified by \code{shiny.browser} if
|
||||
specified. This value of this parameter can also be a
|
||||
function to call with the application's URL.}
|
||||
|
||||
\item{host}{The IPv4 address that the application should
|
||||
listen on. Defaults to the \code{shiny.host} option, if
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
\title{Run Shiny Example Applications}
|
||||
\usage{
|
||||
runExample(example = NA, port = NULL,
|
||||
launch.browser = getOption("shiny.launch.browser", interactive()),
|
||||
launch.browser = "auto",
|
||||
host = getOption("shiny.host", "127.0.0.1"))
|
||||
}
|
||||
\arguments{
|
||||
@@ -15,7 +15,10 @@
|
||||
|
||||
\item{launch.browser}{If true, the system's default web
|
||||
browser will be launched automatically after the app is
|
||||
started. Defaults to true in interactive sessions only.}
|
||||
started. Defaults to \code{"auto"}, which uses the
|
||||
\code{shiny.launch.browser} preference if present, and
|
||||
invokes the browser specified by \code{shiny.browser} if
|
||||
specified.}
|
||||
|
||||
\item{host}{The IPv4 address that the application should
|
||||
listen on. Defaults to the \code{shiny.host} option, if
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
\alias{runGist}
|
||||
\title{Run a Shiny application from https://gist.github.com}
|
||||
\usage{
|
||||
runGist(gist, port = NULL,
|
||||
launch.browser = getOption("shiny.launch.browser", interactive()))
|
||||
runGist(gist, port = NULL, launch.browser = "auto")
|
||||
}
|
||||
\arguments{
|
||||
\item{gist}{The identifier of the gist. For example, if
|
||||
@@ -17,7 +16,10 @@
|
||||
|
||||
\item{launch.browser}{If true, the system's default web
|
||||
browser will be launched automatically after the app is
|
||||
started. Defaults to true in interactive sessions only.}
|
||||
started. Defaults to \code{"auto"}, which uses the
|
||||
\code{shiny.launch.browser} preference if present, and
|
||||
invokes the browser specified by \code{shiny.browser} if
|
||||
specified.}
|
||||
}
|
||||
\description{
|
||||
Download and launch a Shiny application that is hosted on
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
\usage{
|
||||
runGitHub(repo, username = getOption("github.user"),
|
||||
ref = "master", subdir = NULL, port = NULL,
|
||||
launch.browser = getOption("shiny.launch.browser", interactive()))
|
||||
launch.browser = "auto")
|
||||
}
|
||||
\arguments{
|
||||
\item{repo}{Name of the repository}
|
||||
@@ -24,7 +24,10 @@
|
||||
|
||||
\item{launch.browser}{If true, the system's default web
|
||||
browser will be launched automatically after the app is
|
||||
started. Defaults to true in interactive sessions only.}
|
||||
started. Defaults to \code{"auto"}, which uses the
|
||||
\code{shiny.launch.browser} preference if present, and
|
||||
invokes the browser specified by \code{shiny.browser} if
|
||||
specified.}
|
||||
}
|
||||
\description{
|
||||
Download and launch a Shiny application that is hosted in
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
\title{Run a Shiny application from a URL}
|
||||
\usage{
|
||||
runUrl(url, filetype = NULL, subdir = NULL, port = NULL,
|
||||
launch.browser = getOption("shiny.launch.browser", interactive()))
|
||||
launch.browser = "auto")
|
||||
}
|
||||
\arguments{
|
||||
\item{url}{URL of the application.}
|
||||
@@ -22,7 +22,10 @@
|
||||
|
||||
\item{launch.browser}{If true, the system's default web
|
||||
browser will be launched automatically after the app is
|
||||
started. Defaults to true in interactive sessions only.}
|
||||
started. Defaults to \code{"auto"}, which uses the
|
||||
\code{shiny.launch.browser} preference if present, and
|
||||
invokes the browser specified by \code{shiny.browser} if
|
||||
specified.}
|
||||
}
|
||||
\description{
|
||||
Download and launch a Shiny application that is hosted at
|
||||
|
||||
Reference in New Issue
Block a user