Commit Graph
56 Commits
Author SHA1 Message Date
Mario Sanchez Prada c3a9171825 Replaced {{}} GRD placeholders with [[]].
Grit is not happy with the {{}} placeholders. Why are we not just using
<ph>?

Error processing node <?xml version="1.0" encoding="UTF-8"?>
<message name="IDS_BRAVE_PRIVATE_NEW_TAB_BOX_TOR_TEXT_2">
  Using Private Windows only changes what Brave does on your device — it doesn't change anyone else's behavior. Tor hides your IP address from the sites you visit, and hides the sites you visit from your ISP or your employer. Open a Private Window with Tor from the menu, or with {{ key }}.
</message>: {{ key }}.
Traceback (most recent call last):
  File "../../tools/grit/grit.py", line 29, in <module>
    sys.exit(grit.grit_runner.Main(sys.argv[1:]))
  File "C:\bb4\brave-browser\src\tools\grit\grit\grit_runner.py", line 314, in Main
    return toolobject.Run(options, args[1:])
  File "C:\bb4\brave-browser\src\tools\grit\grit\tool\build.py", line 274, in Run
    self.Process()
  File "C:\bb4\brave-browser\src\tools\grit\grit\tool\build.py", line 409, in Process
    self.ProcessNode(self.res, output, tmpfile)
  File "C:\bb4\brave-browser\src\tools\grit\grit\tool\build.py", line 333, in ProcessNode
    formatted = formatter(node, output_node.GetLanguage(), output_dir=base_dir)
  File "C:\bb4\brave-browser\src\tools\grit\grit\format\data_pack.py", line 90, in Format
    value = node.GetDataPackValue(lang, util.BINARY)
  File "C:\bb4\brave-browser\src\tools\grit\grit\node\message.py", line 288, in GetDataPackValue
    message = self.ws_at_start + self.Translate(lang) + self.ws_at_end
  File "C:\bb4\brave-browser\src\tools\grit\grit\node\message.py", line 270, in Translate
    self.ShouldFallbackToEnglish()
  File "C:\bb4\brave-browser\src\tools\grit\grit\clique.py", line 406, in MessageForLanguage
    return pseudolocales.PseudoRTLMessage(self.GetMessage())
  File "C:\bb4\brave-browser\src\tools\grit\grit\pseudolocales.py", line 323, in PseudoRTLMessage
    tree, placeholders = BuildTreeFromMessage(message)
  File "C:\bb4\brave-browser\src\tools\grit\grit\pseudolocales.py", line 271, in BuildTreeFromMessage
    return BuildTree(text), placeholders
  File "C:\bb4\brave-browser\src\tools\grit\grit\pseudolocales.py", line 255, in BuildTree
    assert not leftovers, leftovers
AssertionError: {{ key }}.
2021-03-23 14:55:30 -04:00
Pete Miller cfb39feef2 Upgrade to styled-components v5 2021-03-11 21:31:02 +13:00
Pete Miller 405cc599e2 Storybook: upgrade to v6
core-js added to fix a build reference issue
2021-03-11 21:31:02 +13:00
Anthony Tseng 7c243357c7 Add l10n strings and lint fixes 2021-01-25 12:19:23 -08:00
Anthony Tseng ad41464b85 tor-internals init 2021-01-25 12:19:22 -08:00
Pete Miller d965b16820 New Tab Page: AsyncActionHandler allows multiple handlers for the same action name
Useful to group functionality
2020-12-01 00:57:07 -08:00
Pete Miller 402fbc70c3 Brave Today feed refresh strategy
- When Brave Today is interacted with (scrolled down to), get the current cached feed
- When NTP is opened and Today is enabled, make sure we have either loaded data from cache or fetched the first data feed (and publishers list)
- Whilst Brave Today is open, every 1 minutes, check if the backend has an updated feed, or if it knows that remote has updated feed. The backend will only check for remote update every 10 mins (whilst Brave Today is visible), via a HEAD request.
- Every 2 hours, the backend will do an actual feed refresh regardless of whether Brave Today is open or not
2020-11-07 20:58:50 -08:00
Pete Miller 308567cb28 WebUI: Allow same-origin scripts to be imported after page-load
Creates a trusted types policy which is required now that we have strict trusted types enabled for scripts.
2020-11-07 20:58:50 -08:00
Pete Miller bc8d1c7058 Brave Today: refresh notification button 2020-11-07 20:58:50 -08:00
Pete Miller cf23301704 New Tab Page: Allow page to scroll before Today kicks in and fix backdrop-filter
Also, tighten style for indicator.
Overcomes a bug where a backdrop-filter element's ancestor which has a filter must also have a background. When this bug is fixed then this element won't need the background. Before this commit, the Widget title backgrounds would not correctly have backdrop filter because their ancestor had a blur and not also a background (it came from a higher up ancestor).
2020-11-07 20:58:50 -08:00
Pete Miller 7d49956803 Brave Today: use profile prefs, and remove feed from cache when user clears history
Profile prefs are now used for saving publisher / source enabled or disabled. This is more future proof as this data is not ephemeral.
Also provides a method for resetting those prefs from the NTP "customize" panel. Now that this is a regular profile pref, this could also be cleared from the regular Settings page.
Sets up an event flow from clearing history to the background process which caches the feed. It's important to clear the feed cache when the history is cleared since the feed assigns higher rank to content from hosts that the user has previously visited.
Also allows Today to be turned on and off.
2020-11-07 20:58:50 -08:00
Pete Miller 4b288ec365 Brave Today: allow publishers to be turned on and off 2020-11-07 20:58:50 -08:00
Pete Miller 718865f5a5 Brave extension background script only accepts messages from WebUI 2020-11-07 20:58:50 -08:00
Pete Miller d1542c37a9 Remember scroll position when navigating back after reading an article from Brave Today on NTP
Stores article url in window.history.state. When the back is loaded and has that state, we scroll down to an element that is rendered and is displaying the article url which was previously visited.
TODO: do this for list-type cards. Problem with those is that we must wait for all previous images to be loaded so that the correct scroll position is not maintained as item heights increase when images are loaded.
2020-11-07 20:58:49 -08:00
Pete Miller b9db2f8f0a Brave Today: Include Publishers, wire up all images and deals, add Settings section
Use staging remote URLs for Brave Today content whilst we are waiting for production environment. This is temporary and will be replaced with production URLs before Brave Today is released to the Release channel.
2020-11-07 20:58:49 -08:00
Pete Miller 74379b06cf New Tab Page: Render Today images via remote fetch in background extension and transfer to NTP as data Uri 2020-11-07 20:58:49 -08:00
Pete Miller ad09983904 New Tab Page: Brave Today feed data is transferred from background, and renders successfully (without images) 2020-11-07 20:58:49 -08:00
Pete Miller 92488bb7f1 Framework for communication from WebUI to extension background script 2020-11-07 20:58:49 -08:00
Pete Miller 24c6842f42 Framework for async redux actions 2020-11-07 20:58:49 -08:00
AlexeyBarabash c6f82d3196 Removed some sync v1 leftovers 2020-10-29 10:30:15 +02:00
NejcZdovc 116a87c54e UI updates 2020-10-22 08:46:01 +02:00
yan e26d37516c remove all calls to dangerouslySetInnerHTML
fix https://github.com/brave/brave-browser/issues/11642
2020-09-22 16:30:16 -07:00
Brian R. Bondy aaf5a7a390 Add IPFS WebUI page 2020-09-02 11:10:39 -04:00
mkarolin 900e91b91b source_is_generated -> enable_input_discovery_for_gn_analyze.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/6ade5dc4cb183b0f58cf9c1795fdfc6cba5e14bf

commit 6ade5dc4cb183b0f58cf9c1795fdfc6cba5e14bf
Author: Andrew Grieve <agrieve@chromium.org>
Date:   Tue Mar 17 20:52:02 2020 +0000

    Rename source_is_generated -> enable_input_discovery_for_gn_analyze

    And update docs for the setting.

    Bug: 1054892
2020-05-26 09:52:28 -04:00
Cezar Augusto 76873dafd3 Re-use NTP container in Storybook
Address https://github.com/brave/brave-browser/issues/5180

Storybook stores several copies of container components. This
effort eliminates them in favor of reusing a real-world component.

Limitations apply such as lack of dynamic content. State changes
are triggered via Storybook Knobs hopefully making easier for non-technical
people to understand and hack around Brave features.
2020-02-21 17:36:50 -03:00
Pete Miller d244e466e6 WebUI string helper to extract components of translated strings destined for HTML elements, such as links or bold text 2020-01-25 10:14:02 -08:00
Anton Lazarev 63f176c7e9 bring up reporter modal via new help menu option 2019-11-26 19:10:50 -08:00
Feross Aboukhadijeh 0f432601e9 Remove WebTorrent DNS shim
WebTorrent now includes a built-in shim for require('dns')
in Chrome Apps. The shim is published at:
https://www.npmjs.com/package/chrome-dns

So we no longer need to include a DNS shim for WebTorrent
in Brave itself. This is the last bit of "hackiness" that
we had to remove. Now Brave is effectively shipping
WebTorrent out-of-the-box.

Fixes: https://github.com/brave/brave-browser/issues/5606
2019-08-09 17:56:23 -07:00
Pete Miller f5395dbd71 Shields uses chrome.settingsPrivate API instead of custom chrome.braveShields.{get,set}ViewPreferences API 2019-08-01 14:51:03 -07:00
petemill 58fc5e5682 make transpile_web_ui build template and scripts more understandable
Adds documentation, comments, and renames and reduces variable names
2019-05-22 14:58:40 -07:00
petemill 52df79ae32 webpack build targets now generate a ninja depfile
Add a new custom plugin for webpack which keeps track of every require (or import) module path, and provide a list of these for ninja. After this, build targets which use this template will not need to provide an input list of every JS / TS / CSS / etc file that is used for the build. Instead ninja will use this new generated file to keep track of which files should cause a re-build of a specific target when they are changed.

Tested with:
- Removing inputs of a webpack target
- Generated depfile contains relevant inputs
- Target only builds when an item in the generated depfile is changed

Note that the file path used in the header of the depfile must match precisely the output of the target. If this is different then the target will always be re-built as the depfile will be invalid.
2019-05-22 14:58:33 -07:00
NejcZdovc 517a590f6a Replace donation with tip strings
Resolves https://github.com/brave/brave-browser/issues/4345
2019-05-08 11:39:25 +02:00
petemill 1bb1f534a4 WebUI: BraveCoreThemeProvider automatically switches dark or light based on user preference 2019-03-28 16:15:12 -07:00
Emerick Rogul 5f9ed608a0 Add chrome://rewards-internals WebUI page 2019-03-05 10:32:15 -05:00
Cezar Augusto 24aa3db1af welcome page v2 2018-12-11 20:02:13 -02:00
Pete Miller d25672f9fa Merge pull request #1027 from brave/gn-build-webpack-npm-inputs
all webui targets rebuild when dependencies and dependent config change
2018-12-06 17:33:38 -08:00
petemill 10b86f300d webui generates es2017 output and removes confusing babel config
Babel dependencies were configured but not actually used by any webui bundles since they are all typescript.
Typescript was not configured to output using the latest features supported by v8.

This re-configuration ensures:
- TS output is transpiled to es2017 JS and no further, which should allow for optimizations. Previously it was es5.
- es module syntax is preserved, allowing webpack to tree shake
- async lazy-load import() syntax is preserved, allowing webpack to perform chunking

This also fixes an issue whereby linking brave-ui dependency from a local path would prevent webui compilation.
2018-12-05 12:50:25 -08:00
petemill f697e52eef all webui targets rebuild when dependencies and dependent config change 2018-12-05 12:21:19 -08:00
petemill 38207b1660 Fix public asset path for webpack-generated assets in extensions
For external assets e.g. an .svg file, webpack emits the file in the fs at the path specified by target_gen_dir or target_gen_dir + extra_relative_path. webpack also outputs a relative URL to access these assets. By default this relative URL is '/' but if we do specify an extra relative path, then we need to specify a new public relative url to access those resources. In the case of extensions, this needs to be the portion of the extra_relative_path that is deeper than where the manifest.json lives. This is because chromium matches the extension resources with ones that have the same fs path prefix as the manifest.json path.
2018-11-27 14:41:22 -08:00
petemill 821fcb78d4 Upgrade brave-ui to 0.34.4 and include required new definitions 2018-11-26 22:22:50 -08:00
petemill dfe5df1545 Simplify webpack config
This should have no functional effect
2018-11-19 10:13:04 -08:00
petemill 2fe07f9ec2 Dynamically pack and serve all webpack generated files
As a necessity for that, only build the required webpack entry-point for each target.

This creates a new GN target type "pack_web_resources", which takes the output from the transpile_web_ui target and builds in to a pack. We then take the `GritResourceMap` which is created and use it to ensure that each WebUI or Extension DataSource will serve all files that were generated.

The "transpile_web_ui" target now generates a GRD file to be consumed by this new target, which includes all the files in the webpack output dir.

We also re-pack to combine these generated assets along with their static counterparts (i.e. html file) to the single .pak file that other build targets are expecting.

Follow-ups to come afterwards which are enabled by this:
- Move most other static resources in to webpack-generated resources, especially images. This will reduce the amount of definitions that need to be kept in sync, ensure any optimizations are run, and ensure that we aren't including files that aren't used.
- Use Code Splitting to generate multiple JS files for each WebUI as appropriate.
- More consistent dir structure / targets for components/brave_xyz_ui.
2018-11-19 10:12:54 -08:00
Jocelyn Liu 8249c55857 Shim dns.lookup using chrome.dns.resolve 2018-09-17 21:58:58 -07:00
NejcZdovc b100ed744a Converts to TS 2018-08-31 15:16:07 +02:00
NejcZdovc 78b8036674 Adds ui locale 2018-08-31 15:16:07 +02:00
Jocelyn Liu 4ebe7e4147 Implement webtorrent component 2018-08-30 14:20:50 -07:00
bridiver 96c0cedc3f let each component handle its own transpiling
fix https://github.com/brave/brave-browser/issues/702
2018-08-09 19:39:09 -07:00
Brian R. Bondy ff40756074 Revert "let each component handle its own transpiling" 2018-08-07 18:19:18 -04:00
bridiver 95d25a5fb8 let each component handle its own transpiling 2018-08-04 17:19:28 -07:00
NejcZdovc e842f2bf69 Final changes to fix lint; Removes old dep; Header unification 2018-07-16 13:46:39 +02:00