Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33
Favicon fix#240
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Favicon fix #240
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8e02d61
Adding default favicon
HammadTheOne f31d1aa
Removing redundant codeblock
HammadTheOne 8f81c52
Added default favicon
HammadTheOne cff1e9d
Minor fix to requests prefix
HammadTheOne fbe68bd
Update CHANGELOG.md
HammadTheOne b80785f
Added simple test
HammadTheOne 43e11bf
Fixed typo
HammadTheOne 13805ab
Fixed typo
HammadTheOne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -116,7 +116,7 @@ Dash <- R6::R6Class( | ||
| # ------------------------------------------------------------ | ||
| router <- routr::RouteStack$new() | ||
| server$set_data("user-routes", list()) # placeholder for custom routes | ||
| # ensure that assets_folder is neither NULL nor character(0) | ||
| if (!(is.null(private$assets_folder)) & length(private$assets_folder) != 0) { | ||
| if (!(dir.exists(private$assets_folder)) && gsub("/+", "", assets_folder) != "assets") { | ||
| @@ -494,13 +494,17 @@ Dash <- R6::R6Class( | ||
| } | ||
| TRUE | ||
| }) | ||
| dash_favicon <- paste0(self$config$routes_pathname_prefix, "_favicon.ico") | ||
| route$add_handler("get", dash_favicon, function(request, response, keys, ...) { | ||
| asset_path <- get_asset_path(private$asset_map, | ||
| "/favicon.ico") | ||
| # If custom favicon is not present, get the path for the default Dash favicon | ||
| if (is.na(names(asset_path))) { | ||
| asset_path <- system.file("extdata", "favicon.ico", package = "dash") | ||
| } | ||
| file_handle <- file(asset_path, "rb") | ||
| response$body <- readBin(file_handle, | ||
| raw(), | ||
| @@ -1891,17 +1895,18 @@ Dash <- R6::R6Class( | ||
| # create tag for favicon, if present | ||
| # other_files_map[names(other_files_map) %in% "/favicon.ico"] | ||
| if ("/favicon.ico" %in% names(private$asset_map$other)) { | ||
| favicon <- sprintf("<link href=\"/_favicon.ico\" rel=\"icon\" type=\"image/x-icon\">") | ||
| favicon_url <- sprintf('\"%s_favicon.ico\"', self$config$requests_pathname_prefix) | ||
| favicon <- sprintf("<link href=%s rel=\"icon\" type=\"image/x-icon\">", favicon_url) | ||
| } else { | ||
| favicon <- "" | ||
| favicon_url <- sprintf('\"%s_favicon.ico\"', self$config$requests_pathname_prefix) | ||
| favicon <- sprintf("<link href=%s rel=\"icon\" type=\"image/x-icon\">", favicon_url) | ||
| } | ||
| # set script tag to invoke a new dash_renderer | ||
| scripts_invoke_renderer <- sprintf("<script id=\"%s\" type=\"%s\">%s</script>", | ||
| "_dash-renderer", | ||
| "application/javascript", | ||
| "var renderer = new DashRenderer();") | ||
| # add inline tags | ||
| scripts_inline <- private$inline_scripts | ||
| @@ -1961,24 +1966,6 @@ Dash <- R6::R6Class( | ||
| private$.index <- private$template_index | ||
| } | ||
| # define the react-entry-point | ||
| app_entry <- "<div id='react-entry-point'><div class='_dash-loading'>Loading...</div></div>" | ||
| # define the dash default config key | ||
| config <- sprintf("<script id='_dash-config' type='application/json'> %s </script>", to_JSON(self$config)) | ||
| if (is.null(private$name)) | ||
| private$name <- 'Dash' | ||
| if (!is.null(private$custom_index)) { | ||
| string_index <- glue::glue(private$custom_index, .open = "{%", .close = "%}") | ||
| private$.index <- string_index | ||
| } | ||
| else if (length(private$template_index) == 1) { | ||
| private$.index <- private$template_index | ||
| } | ||
rpkyle marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| else { | ||
| private$.index <- sprintf( | ||
| '<!DOCTYPE html> | ||
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.