Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix demo connect #469

Draft
wants to merge 4 commits into
base: demo-shinyapps.io
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Imports:
formattable,
glue,
golem (>= 0.3.2),
httr,
jsonlite,
loggit,
lubridate,
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ importFrom(golem,bundle_resources)
importFrom(golem,favicon)
importFrom(golem,get_golem_options)
importFrom(golem,with_golem_options)
importFrom(httr,GET)
importFrom(httr,http_status)
importFrom(jsonlite,read_json)
importFrom(jsonlite,write_json)
importFrom(loggit,loggit)
Expand Down
15 changes: 9 additions & 6 deletions R/mod_uploadPackage.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ uploadPackageUI <- function(id) {
#' @importFrom rintrojs introjs
#' @importFrom utils read.csv available.packages
#' @importFrom rvest read_html html_nodes html_text
#' @importFrom httr http_status GET
#' @keywords internal
#'
uploadPackageServer <- function(id, user) {
Expand Down Expand Up @@ -224,9 +225,10 @@ uploadPackageServer <- function(id, user) {
invalidateLater(60*1000)

withProgress({
good_urls <- purrr::map_lgl(checking_urls$url_lst,
~ try(curlGetHeaders(.x, verify = FALSE), silent = TRUE) %>%
{class(.) != "try-error" && attr(., "status") != 404})
good_urls <- purrr::map_lgl(checking_urls$url_lst, function(.x) {
status <- try(httr::http_status(httr::GET(.x)), silent = TRUE)
class(status) != "try-error" && status$category == "Success"
})
Sys.sleep(.5)
}, message = "Checking URLs")

Expand Down Expand Up @@ -260,9 +262,10 @@ uploadPackageServer <- function(id, user) {
"https://cranlogs.r-pkg.org"
)

good_urls <- purrr::map_lgl(url_lst,
~ try(curlGetHeaders(.x, verify = FALSE), silent = TRUE) %>%
{class(.) != "try-error" && attr(., "status") != 404})
good_urls <- purrr::map_lgl(url_lst, function(.x) {
status <- try(httr::http_status(httr::GET(.x)), silent = TRUE)
class(status) != "try-error" && status$category == "Success"
})

if (!all(good_urls)) {
checking_urls$url_lst <- url_lst[!good_urls]
Expand Down
2 changes: 1 addition & 1 deletion app.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

pkgload::load_all(export_all = FALSE,helpers = FALSE,attach_testthat = FALSE)
options( "golem.app.prod" = TRUE)
riskassessment::run_app(login_note = shiny::HTML(
riskassessment::run_app(pre_auth_user = TRUE, login_note = shiny::HTML(
"<em>Note:</em><br>
To run as ADMIN, type username
<span style='text-transform:none;'><u>demo_admin</u></span> with password <u><span style='text-transform:none;'>Admin@1</span></u> above.
Expand Down
3 changes: 2 additions & 1 deletion dev/run_dev.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ golem::detach_all_attached()
golem::document_and_reload()

# Run the application
run_app(login_note = shiny::HTML('<em>Note:</em> To log in for the first time, use the admin user:
run_app(pre_auth_user = TRUE,
login_note = shiny::HTML('<em>Note:</em> To log in for the first time, use the admin user:
<u>admin</u> with password <u>QWERTY1</u>.'))

# # turn off any options
Expand Down