From 7d6f5aa40545161b1b3c0194f80bfed49a9e03f8 Mon Sep 17 00:00:00 2001 From: Tony Sansone Date: Thu, 31 Aug 2023 16:19:23 -0500 Subject: [PATCH 01/14] Add note about publishing from China --- src/community/china.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/community/china.md b/src/community/china.md index 9432c1ffe9b..96f1f4fa340 100644 --- a/src/community/china.md +++ b/src/community/china.md @@ -11,7 +11,7 @@ of the Flutter website available at [https://flutter.cn](https://flutter.cn), maintained by [The China Flutter User Group (CFUG)][]. -If you'd like to install Flutter using an +If you’d like to install Flutter using an [installation bundle]({{site.url}}/release/archive), you can replace the domain of the original URL with a trusted mirror to speed it up. For example: @@ -66,10 +66,19 @@ If you're interested in setting up your own mirror in China, contact [flutter-dev@googlegroups.com](mailto:flutter-dev@googlegroups.com) for assistance. -If you're running into issues that only occur when using the `flutter-io.cn` server, -consider reporting the issue to +If you're running into issues that only occur when +using the `flutter-io.cn` server, consider reporting the issue to [the issue tracker (镜像问题)](https://github.com/cfug/flutter.cn/issues/new/choose). +## Publishing apps + +If you receive errors when attempting to publish your package, +you might need to configure a proxy. + +To configure a proxy, check out the [Dart documentation on proxies][]. + +[Dart documentation on proxies]: {{dart-site}}/tools/pub/troubleshoot#pub-get-fails-from-behind-a-corporate-firewall + ## Community-run mirror sites * Shanghai Jiao Tong University Linux User Group From d169ecc747ad26878c3cd98a927d577187e9a1f7 Mon Sep 17 00:00:00 2001 From: Tony Sansone Date: Fri, 27 Oct 2023 10:43:40 -0500 Subject: [PATCH 02/14] Update for Chinese Flutter install --- src/community/china.md | 200 +++++++++++++++++++++++++++++------------ 1 file changed, 144 insertions(+), 56 deletions(-) diff --git a/src/community/china.md b/src/community/china.md index 96f1f4fa340..d7d4d04ab9c 100644 --- a/src/community/china.md +++ b/src/community/china.md @@ -6,15 +6,83 @@ toc: true {% assign path = 'flutter_infra_release/releases/stable/windows/flutter_windows_3.3.0-stable.zip' -%} -The Flutter community has made a Simplified Chinese version -of the Flutter website available at -[https://flutter.cn](https://flutter.cn), -maintained by [The China Flutter User Group (CFUG)][]. +To speed the download and installation of Flutter in China, +consider using a mirror site. -If you’d like to install Flutter using an -[installation bundle]({{site.url}}/release/archive), -you can replace the domain of the original URL with a trusted mirror -to speed it up. For example: +{{site.alert.important}} + Use mirror sites only if you _trust_ the provider. + The Flutter team cannot verify their reliability or security. +{{site.alert.end}} + +## Use a Flutter mirror site + +The [China Flutter User Group][] (CFUG) maintains a Simplified Chinese +Flutter website [https://flutter.cn](https://flutter.cn) and a mirror. +Other mirrors can be found at the [end of this guide](#known-trusted-community-run-mirror-sites). + +### Configure your machine to use a mirror site + +To install or use Flutter in China, +use a trustworthy Flutter mirror site. +This requires setting two environment variables on your machine. + +_All examples that follow presume that you are using the CFUG mirror._ + +To set your machine to use a mirror site on macOS or Linux: + +1. Create and change into the directory where you plan + to store your local Flutter clone. + +1. Set your pub URL to your mirror site. + + ```terminal + $ export PUB_HOSTED_URL=https://pub.flutter-io.cn + ``` + +1. Set your Flutter storage URL to your mirror site. + + ```terminal + $ export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn + ``` + +1. Clone the Flutter repo from your mirror site. + + ```terminal + $ git clone -b dev {{site.repo.flutter}}.git + ``` + +1. Add Flutter to your `PATH` environment variable. + + ```terminal + $ export PATH="$PWD/flutter/bin:$PATH" + ``` + +1. Run Flutter Doctor to verify your installation. + + ```terminal + $ flutter doctor + ``` + +1. Return to the [setting up Flutter]({{site.url}}/get-started/editor) + guide and continue from that procedure. + +From this example, `flutter pub get` fetches packages from `flutter-io.cn`. +in any terminal where you set `PUB_HOSTED_URL` and `FLUTTER_STORAGE_BASE_URL`. + +Any environment variables set using `export` in this procedure +only apply to the current terminal window. +To set these values on a permanent basis, +add those three `export` commands to the bottom of the `*rc` or `*_profile` +file that your preferred shell uses. + +### Download other versions of Flutter + +To install a different version of Flutter found in the +[archive]({{site.url}}/release/archive), +replace `storage.googleapis.com` with that of your trusted mirror. +This should improve download speed. + +For example: * Original URL:
[`https://storage.googleapis.com/{{path}}`](https://storage.googleapis.com/{{path}}) @@ -22,67 +90,87 @@ to speed it up. For example: * Mirrored URL:
[`https://storage.flutter-io.cn/{{path}}`](https://storage.flutter-io.cn/{{path}}) -You must also set two environment variables to upgrade Flutter and use the pub -package repository in China. Instructions are below. +## Configure your machine to publish your package -{{site.alert.important}} - Use mirror sites only if you _trust_ the provider. - The Flutter team cannot verify their reliability or security. -{{site.alert.end}} +If you receive errors when attempting to publish your package, +try one of the following solutions: -## Configuring Flutter to use a mirror site - -If you're installing or using Flutter in China, -it might be helpful to use a trustworthy local -mirror site that hosts Flutter's dependencies. -To instruct the Flutter tool to use an alternate storage location, -you need to set two environment variables, `PUB_HOSTED_URL` and -`FLUTTER_STORAGE_BASE_URL`, before running the `flutter` command. - -Taking macOS or Linux as an example, here are the first few steps in -the setup process for using a mirror site. Run the following in a Bash -shell from the directory where you wish to store your local Flutter clone: - -```terminal -$ export PUB_HOSTED_URL=https://pub.flutter-io.cn -$ export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn -$ git clone -b dev {{site.repo.flutter}}.git -$ export PATH="$PWD/flutter/bin:$PATH" -$ cd ./flutter -$ flutter doctor -``` + {% comment %} + From https://github.com/flutter/website/pull/9338#discussion_r1328077020 + {% endcomment %} + +1. Clear your `PUB_HOSTED_URL` environment variable. + + ```terminal + $ unset PUB_HOSTED_URL + ``` + + Remember to reset this environment variable after you publish. + + ```terminal + export PUB_HOSTED_URL=https://pub.flutter-io.cn + ``` + +1. Configure a proxy. + To configure a proxy, check out the [Dart documentation on proxies][]. + + {% comment %} + From https://github.com/flutter/website/issues/2556#issuecomment-481566476 + {% endcomment %} + +1. Enable your VPN without adding a `credentials.json` file. -After these steps, you should be able to continue -[setting up Flutter]({{site.url}}/get-started/editor) normally. -From here on, packages fetched by `flutter pub get` are -downloaded from `flutter-io.cn` in any shell where `PUB_HOSTED_URL` -and `FLUTTER_STORAGE_BASE_URL` are set. +1. Disable your proxy and add a `credentials.json` file. + +[Dart documentation on proxies]: {{site.dart-site}}/tools/pub/troubleshoot#pub-get-fails-from-behind-a-corporate-firewall + +## Details on mirror sites + +### Support for mirror sites + +The Flutter team cannot guarantee long-term availability of any mirrors. +You can use other mirrors if they become available. + +### New mirror sites in China -The `flutter-io.cn` server is a provisional mirror for Flutter -dependencies and packages maintained by [The China Flutter User Group (CFUG)][]. -The Flutter team cannot guarantee long-term availability of this service. -You're free to use other mirrors if they become available. If you're interested in setting up your own mirror in China, contact [flutter-dev@googlegroups.com](mailto:flutter-dev@googlegroups.com) for assistance. +### Known, trusted community-run mirror sites + +#### China Flutter User Group + +[China Flutter User Group][] maintains the `flutter-io.cn` mirror. +It includes Flutter and packages. + If you're running into issues that only occur when -using the `flutter-io.cn` server, consider reporting the issue to -[the issue tracker (镜像问题)](https://github.com/cfug/flutter.cn/issues/new/choose). +using the `flutter-io.cn` mirror, report the issue to their +[issue tracker (镜像问题)]({{site.github}}/cfug/flutter.cn/issues/new/choose). -## Publishing apps +To set your machine to use this mirror, use these commands: -If you receive errors when attempting to publish your package, -you might need to configure a proxy. +```bash +export PUB_HOSTED_URL=https://pub.flutter-io.cn +export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn +``` -To configure a proxy, check out the [Dart documentation on proxies][]. +#### Shanghai Jiao Tong University *nix User Group -[Dart documentation on proxies]: {{dart-site}}/tools/pub/troubleshoot#pub-get-fails-from-behind-a-corporate-firewall +[Shanghai Jiao Tong University *nix User Group][] +maintains the `mirror.sjtu.edu.cn` mirror. +It includes Flutter and packages. -## Community-run mirror sites +If you're running into issues that only occur when +using the `mirror.sjtu.edu.cn` mirror, report the issue to their +[issue tracker (议题)](https://git.sjtu.edu.cn/sjtug/flutter-sdk/-/issues). + +To set your machine to use this mirror, use these commands: -* Shanghai Jiao Tong University Linux User Group - * `FLUTTER_STORAGE_BASE_URL`: [https://mirror.sjtu.edu.cn/](https://mirror.sjtu.edu.cn) - * `PUB_HOSTED_URL`: [https://mirror.sjtu.edu.cn/dart-pub/](https://mirror.sjtu.edu.cn/dart-pub) +```bash +export FLUTTER_STORAGE_BASE_URL=https://mirror.sjtu.edu.cn +export PUB_HOSTED_URL=https://mirror.sjtu.edu.cn/flutter-infra +``` -[The China Flutter User Group (CFUG)]: https://github.com/cfug +[China Flutter User Group]: https://github.com/cfug +[Shanghai Jiao Tong University *nix User Group]: https://github.com/sjtug From 93999f4ec68aa7b43dd0f56deaa7a7aaf6b290a0 Mon Sep 17 00:00:00 2001 From: Anthony Sansone Date: Sun, 29 Oct 2023 11:24:58 -0500 Subject: [PATCH 03/14] Apply suggestions from code review from @AlexV525 Co-authored-by: Alex Li --- src/community/china.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/community/china.md b/src/community/china.md index d7d4d04ab9c..4e9fd9ca4d7 100644 --- a/src/community/china.md +++ b/src/community/china.md @@ -48,7 +48,7 @@ To set your machine to use a mirror site on macOS or Linux: 1. Clone the Flutter repo from your mirror site. ```terminal - $ git clone -b dev {{site.repo.flutter}}.git + $ git clone -b stable {{site.repo.flutter}}.git ``` 1. Add Flutter to your `PATH` environment variable. @@ -72,7 +72,7 @@ in any terminal where you set `PUB_HOSTED_URL` and `FLUTTER_STORAGE_BASE_URL`. Any environment variables set using `export` in this procedure only apply to the current terminal window. To set these values on a permanent basis, -add those three `export` commands to the bottom of the `*rc` or `*_profile` +add those three `export` commands to the bottom of the `*rc` or `*profile` file that your preferred shell uses. ### Download other versions of Flutter @@ -92,8 +92,8 @@ For example: ## Configure your machine to publish your package -If you receive errors when attempting to publish your package, -try one of the following solutions: +Before publishing your packages to pub.dev, reset your environments +to defaults to complete the process: {% comment %} From https://github.com/flutter/website/pull/9338#discussion_r1328077020 From e9270d9099f747e5ec18d98e781c28417ef87346 Mon Sep 17 00:00:00 2001 From: Tony Sansone Date: Mon, 30 Oct 2023 19:02:05 -0500 Subject: [PATCH 04/14] Update per @AlexV525 review --- src/assets/js/main.js | 3 +- src/community/china/_os-settings.md | 106 ++++++++++++++++++ src/community/{china.md => china/index.md} | 119 +++++++++------------ 3 files changed, 160 insertions(+), 68 deletions(-) create mode 100644 src/community/china/_os-settings.md rename src/community/{china.md => china/index.md} (63%) diff --git a/src/assets/js/main.js b/src/assets/js/main.js index 2e9ad3fcc64..250e00797a5 100644 --- a/src/assets/js/main.js +++ b/src/assets/js/main.js @@ -20,9 +20,8 @@ document.addEventListener("DOMContentLoaded", function(_) { setupTabs($('#vscode-to-vs-setup'), 'dev.flutter.debug.vscode-to-vs'); setupTabs($('#add-to-app-android'), 'dev.flutter.add-to-app.android'); setupTabs($('#add-to-app-android-deps'), 'dev.flutter.add-to-app.android.deps'); - - setupTabs($('#ios-versions'), 'dev.flutter.ios-versions'); + setupTabs($('#china-os-tabs'), 'dev.flutter.china-os'); prettyPrint(); }); diff --git a/src/community/china/_os-settings.md b/src/community/china/_os-settings.md new file mode 100644 index 00000000000..ce1850ea401 --- /dev/null +++ b/src/community/china/_os-settings.md @@ -0,0 +1,106 @@ +{% assign id = include.os | downcase -%} + +{% if id == 'windows' -%} +{% assign shell = 'Powershell' -%} +{% assign prompt = 'C:\>' -%} +{% assign envvarset = 'C:\> $env:' -%} +{% assign setpath = 'C:\> $env:PATH = $pwd.PATH + "/flutter/bin",$env:PATH -join ";"' -%} +{% assign comtoset = 'env:' -%} +{% assign unzip='Extract-Archive' %} +{% capture permaddexample -%} +$newPath = $pwd.PATH + "/flutter/bin",$env:PATH -join ";" +[System.Environment]::SetEnvironmentVariable('Path',$newPath,User) +[System.Environment]::SetEnvironmentVariable('PUB_HOSTED_URL','https://pub.flutter-io.cn',User) +[System.Environment]::SetEnvironmentVariable('FLUTTER_STORAGE_BASE_URL','https://storage.flutter-io.cn',User) +{% endcapture -%} +{% else -%} +{% assign shell = 'your terminal' -%} +{% assign prompt = '$' -%} +{% assign envvarset = '$ export ' -%} +{% assign setpath = '$ export PATH="$PWD/flutter/bin:$PATH"' -%} +{% assign comtoset = 'export' -%} +{% assign unzip='unzip' %} +{% capture permaddexample -%} +cat <> ~/.zprofile +{{envvarset}}PUB_HOSTED_URL="https://pub.flutter-io.cn" +{{envvarset}}FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn" +{{setpath}} +EOT +{% endcapture -%} +{% endif -%} + +
+ +1. Create and change into the directory where you plan + to store your local Flutter clone. + +1. Set your pub URL to your mirror site. + In {{shell}}, run the following command: + + ```terminal + {{envvarset}}PUB_HOSTED_URL="https://pub.flutter-io.cn" + ``` + +1. Set your Flutter storage URL to your mirror site. + In {{shell}}, run the following command: + + ```terminal + {{envvarset}}FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn" + ``` + +1. Download the Flutter archive from your mirror site. + In your preferred browser, go to https://flutter.cn/docs/release/archive. + +1. Create a folder where you can install Flutter. + + Consider + {% if id == 'windows' -%} + `%USERPROFILE%` or `D:\dev`. + {% else -%} + `~/dev`. + {% endif %} + +1. Extract the zip file. + + ```terminal + {{unzip}} flutter_sdk_v1.0.0.zip + ``` + +1. Add Flutter to your `PATH` environment variable. + In {{shell}}, run the following command: + + ```terminal + {{setpath}} + ``` + +1. Run Flutter Doctor to verify your installation. + In {{shell}}, run the following command: + + ```terminal + {{prompt}} flutter doctor + ``` + +1. Return to the [setting up Flutter]({{site.url}}/get-started/editor) + guide and continue from that procedure. + +From this example, `flutter pub get` fetches packages from `flutter-io.cn`. +in any terminal where you set `PUB_HOSTED_URL` and `FLUTTER_STORAGE_BASE_URL`. + +Any environment variables set using `{{comtoset}}` in this procedure +only apply to the current window. + +To set these values on a permanent basis, +{% if id == 'windows' -%} +set the enviroment variables as in the following example: +{% else -%} +append those three `export` commands to the `*rc` or `*profile` +file that your preferred shell uses. This would resemble the following: +{% endif -%} + +```terminal +{{permaddexample}} +``` + +
diff --git a/src/community/china.md b/src/community/china/index.md similarity index 63% rename from src/community/china.md rename to src/community/china/index.md index 4e9fd9ca4d7..1d9e619f215 100644 --- a/src/community/china.md +++ b/src/community/china/index.md @@ -2,6 +2,7 @@ title: Using Flutter in China description: Where to find a version of the Flutter site that is localized to Simplified Chinese. toc: true +os-list: [Windows, macOS, Linux, ChromeOS] --- {% assign path = 'flutter_infra_release/releases/stable/windows/flutter_windows_3.3.0-stable.zip' -%} @@ -22,58 +23,30 @@ Other mirrors can be found at the [end of this guide](#known-trusted-community-r ### Configure your machine to use a mirror site -To install or use Flutter in China, -use a trustworthy Flutter mirror site. +To install or use Flutter in China, use a trustworthy Flutter mirror site. This requires setting two environment variables on your machine. _All examples that follow presume that you are using the CFUG mirror._ -To set your machine to use a mirror site on macOS or Linux: - -1. Create and change into the directory where you plan - to store your local Flutter clone. - -1. Set your pub URL to your mirror site. - - ```terminal - $ export PUB_HOSTED_URL=https://pub.flutter-io.cn - ``` - -1. Set your Flutter storage URL to your mirror site. - - ```terminal - $ export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn - ``` - -1. Clone the Flutter repo from your mirror site. - - ```terminal - $ git clone -b stable {{site.repo.flutter}}.git - ``` - -1. Add Flutter to your `PATH` environment variable. - - ```terminal - $ export PATH="$PWD/flutter/bin:$PATH" - ``` - -1. Run Flutter Doctor to verify your installation. - - ```terminal - $ flutter doctor - ``` - -1. Return to the [setting up Flutter]({{site.url}}/get-started/editor) - guide and continue from that procedure. - -From this example, `flutter pub get` fetches packages from `flutter-io.cn`. -in any terminal where you set `PUB_HOSTED_URL` and `FLUTTER_STORAGE_BASE_URL`. - -Any environment variables set using `export` in this procedure -only apply to the current terminal window. -To set these values on a permanent basis, -add those three `export` commands to the bottom of the `*rc` or `*profile` -file that your preferred shell uses. +To set your machine to use a mirror site: + +{% comment %} Nav tabs {% endcomment -%} + + +{% comment %} Tab panes {% endcomment -%} +
+{% include_relative _os-settings.md os="Windows" %} +{% include_relative _os-settings.md os="macOS" %} +{% include_relative _os-settings.md os="Linux" %} +{% include_relative _os-settings.md os="ChromeOS" %} +
### Download other versions of Flutter @@ -92,24 +65,20 @@ For example: ## Configure your machine to publish your package -Before publishing your packages to pub.dev, reset your environments -to defaults to complete the process: +To publish your packages to pub.dev, +you need to access the pub.dev site. - {% comment %} - From https://github.com/flutter/website/pull/9338#discussion_r1328077020 - {% endcomment %} +This procedure works even if you have set permanent values for your machine. -1. Clear your `PUB_HOSTED_URL` environment variable. +1. Open a new terminal window. - ```terminal - $ unset PUB_HOSTED_URL - ``` +1. Set your machine to use the default environment variables. - Remember to reset this environment variable after you publish. + {% comment %} + From https://github.com/flutter/website/pull/9338#discussion_r1328077020 + {% endcomment %} - ```terminal - export PUB_HOSTED_URL=https://pub.flutter-io.cn - ``` +To access pub.dev, you can use one of three options: 1. Configure a proxy. To configure a proxy, check out the [Dart documentation on proxies][]. @@ -131,9 +100,9 @@ to defaults to complete the process: The Flutter team cannot guarantee long-term availability of any mirrors. You can use other mirrors if they become available. -### New mirror sites in China +### New mirror sites -If you're interested in setting up your own mirror in China, +If you're interested in setting up your own mirror, contact [flutter-dev@googlegroups.com](mailto:flutter-dev@googlegroups.com) for assistance. @@ -148,13 +117,22 @@ If you're running into issues that only occur when using the `flutter-io.cn` mirror, report the issue to their [issue tracker (镜像问题)]({{site.github}}/cfug/flutter.cn/issues/new/choose). -To set your machine to use this mirror, use these commands: +To set your machine to use this mirror, use these commands. + +On macOS, Linux, or ChromeOS: ```bash export PUB_HOSTED_URL=https://pub.flutter-io.cn export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn ``` +On Windows: + +```powershell +$env:PUB_HOSTED_URL="https://pub.flutter-io.cn" +$env:FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn" +``` + #### Shanghai Jiao Tong University *nix User Group [Shanghai Jiao Tong University *nix User Group][] @@ -163,14 +141,23 @@ It includes Flutter and packages. If you're running into issues that only occur when using the `mirror.sjtu.edu.cn` mirror, report the issue to their -[issue tracker (议题)](https://git.sjtu.edu.cn/sjtug/flutter-sdk/-/issues). +[issue tracker (议题)](https://github.com/sjtug/mirror-requests). + +To set your machine to use this mirror, use these commands. -To set your machine to use this mirror, use these commands: +On macOS, Linux, or ChromeOS: ```bash export FLUTTER_STORAGE_BASE_URL=https://mirror.sjtu.edu.cn export PUB_HOSTED_URL=https://mirror.sjtu.edu.cn/flutter-infra ``` +On Windows: + +```powershell +$env:PUB_HOSTED_URL="https://mirror.sjtu.edu.cn" +$env:FLUTTER_STORAGE_BASE_URL="https://mirror.sjtu.edu.cn/flutter-infra" +``` + [China Flutter User Group]: https://github.com/cfug [Shanghai Jiao Tong University *nix User Group]: https://github.com/sjtug From 199cb4801774c5cdc9a76ebc52651db5a3025eed Mon Sep 17 00:00:00 2001 From: Anthony Sansone Date: Mon, 30 Oct 2023 22:21:42 -0500 Subject: [PATCH 05/14] Apply suggestions from code review Co-authored-by: Alex Li --- src/community/china/_os-settings.md | 2 +- src/community/china/index.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/community/china/_os-settings.md b/src/community/china/_os-settings.md index ce1850ea401..d7cf17ebc5b 100644 --- a/src/community/china/_os-settings.md +++ b/src/community/china/_os-settings.md @@ -85,7 +85,7 @@ EOT 1. Return to the [setting up Flutter]({{site.url}}/get-started/editor) guide and continue from that procedure. -From this example, `flutter pub get` fetches packages from `flutter-io.cn`. +From this example, `flutter pub get` fetches packages from `flutter-io.cn`, in any terminal where you set `PUB_HOSTED_URL` and `FLUTTER_STORAGE_BASE_URL`. Any environment variables set using `{{comtoset}}` in this procedure diff --git a/src/community/china/index.md b/src/community/china/index.md index 1d9e619f215..a5b091ede77 100644 --- a/src/community/china/index.md +++ b/src/community/china/index.md @@ -87,9 +87,9 @@ To access pub.dev, you can use one of three options: From https://github.com/flutter/website/issues/2556#issuecomment-481566476 {% endcomment %} -1. Enable your VPN without adding a `credentials.json` file. +1. Make sure the `PUB_HOSTED_URL` environment variable is unset or is empty. -1. Disable your proxy and add a `credentials.json` file. +1. Enable your proxy and get authorized through Google OAuth with pub.dev by publishing the package. [Dart documentation on proxies]: {{site.dart-site}}/tools/pub/troubleshoot#pub-get-fails-from-behind-a-corporate-firewall From 2ba94c62c0e900ef9479d91a4f2be49c87da4b8d Mon Sep 17 00:00:00 2001 From: Tony Sansone Date: Mon, 30 Oct 2023 22:37:51 -0500 Subject: [PATCH 06/14] Made more changes per @AlexV525 --- src/community/china/index.md | 41 +++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/community/china/index.md b/src/community/china/index.md index a5b091ede77..d30c1d08435 100644 --- a/src/community/china/index.md +++ b/src/community/china/index.md @@ -68,12 +68,6 @@ For example: To publish your packages to pub.dev, you need to access the pub.dev site. -This procedure works even if you have set permanent values for your machine. - -1. Open a new terminal window. - -1. Set your machine to use the default environment variables. - {% comment %} From https://github.com/flutter/website/pull/9338#discussion_r1328077020 {% endcomment %} @@ -87,12 +81,43 @@ To access pub.dev, you can use one of three options: From https://github.com/flutter/website/issues/2556#issuecomment-481566476 {% endcomment %} -1. Make sure the `PUB_HOSTED_URL` environment variable is unset or is empty. +1. Verify that your `PUB_HOSTED_URL` environment variable is either unset + or empty. + + On macOS, Linux, or ChromeOS, run this command: + + ```bash + echo $PUB_HOSTED_URL + ``` + + If this command returns any value, unset it. + + ```bash + unset $PUB_HOSTED_URL + ``` -1. Enable your proxy and get authorized through Google OAuth with pub.dev by publishing the package. + On Windows, run this command: + + ```powershell + echo $env:PUB_HOSTED_URL + ``` + + If this command returns any value, unset it. + + ```powershell + Remove-Item $env:PUB_HOSTED_URL + ``` + +1. Enable your proxy then publish your package and get authorized + through Google OAuth with pub.dev. + +To learn more about publishing packages, check out +[Dart documentation on publishing packages][] [Dart documentation on proxies]: {{site.dart-site}}/tools/pub/troubleshoot#pub-get-fails-from-behind-a-corporate-firewall +[Dart documentation on publishing packages]: {{site.dart-site}}/tools/pub/publishing + ## Details on mirror sites ### Support for mirror sites From 7e7f336dcc903153229b2968f13bd903d036a8a9 Mon Sep 17 00:00:00 2001 From: Anthony Sansone Date: Tue, 31 Oct 2023 11:19:01 -0500 Subject: [PATCH 07/14] Apply suggestions from code review from @AlexV525 @AlexV525 : Great help on this. Thanks! Co-authored-by: Alex Li --- src/community/china/index.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/community/china/index.md b/src/community/china/index.md index d30c1d08435..824215b8e08 100644 --- a/src/community/china/index.md +++ b/src/community/china/index.md @@ -48,12 +48,16 @@ To set your machine to use a mirror site: {% include_relative _os-settings.md os="ChromeOS" %} -### Download other versions of Flutter +### Download Flutter archives based on a mirrored URL -To install a different version of Flutter found in the -[archive]({{site.url}}/release/archive), -replace `storage.googleapis.com` with that of your trusted mirror. -This should improve download speed. +To download Flutter archives from a mirrored URL, +replace `storage.googleapis.com` with the URL of your trusted mirror. +This should improve download speed and the replaced URL +can be used to download other software. + +{{site.alert.note}} + Not every mirror supports downloading artifacts using a replaced URL. +{{site.alert.end}} For example: @@ -66,13 +70,13 @@ For example: ## Configure your machine to publish your package To publish your packages to pub.dev, -you need to access the pub.dev site. +you need to be able to access both Google Auth and the pub.dev site. {% comment %} From https://github.com/flutter/website/pull/9338#discussion_r1328077020 {% endcomment %} -To access pub.dev, you can use one of three options: +To publish packages to pub.dev: 1. Configure a proxy. To configure a proxy, check out the [Dart documentation on proxies][]. @@ -108,11 +112,8 @@ To access pub.dev, you can use one of three options: Remove-Item $env:PUB_HOSTED_URL ``` -1. Enable your proxy then publish your package and get authorized - through Google OAuth with pub.dev. - To learn more about publishing packages, check out -[Dart documentation on publishing packages][] +[Dart documentation on publishing packages][]. [Dart documentation on proxies]: {{site.dart-site}}/tools/pub/troubleshoot#pub-get-fails-from-behind-a-corporate-firewall @@ -125,7 +126,7 @@ To learn more about publishing packages, check out The Flutter team cannot guarantee long-term availability of any mirrors. You can use other mirrors if they become available. -### New mirror sites +### Host new mirror sites If you're interested in setting up your own mirror, contact [flutter-dev@googlegroups.com](mailto:flutter-dev@googlegroups.com) From 250fd6faa2bb4847bc03eea2ea6f6c9a768c1597 Mon Sep 17 00:00:00 2001 From: Anthony Sansone Date: Wed, 1 Nov 2023 01:51:13 -0500 Subject: [PATCH 08/14] Update src/community/china/index.md --- src/community/china/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/community/china/index.md b/src/community/china/index.md index 824215b8e08..0a34c51dd8c 100644 --- a/src/community/china/index.md +++ b/src/community/china/index.md @@ -52,8 +52,8 @@ To set your machine to use a mirror site: To download Flutter archives from a mirrored URL, replace `storage.googleapis.com` with the URL of your trusted mirror. -This should improve download speed and the replaced URL -can be used to download other software. +This should improve download speed. + You can use the replaced URL in other applications to download software. {{site.alert.note}} Not every mirror supports downloading artifacts using a replaced URL. From 70f0c48e2fe5b3922f2ac1a683f7356516142b6e Mon Sep 17 00:00:00 2001 From: Anthony Sansone Date: Wed, 1 Nov 2023 01:52:26 -0500 Subject: [PATCH 09/14] Apply suggestions from code review from @AlexV525 Co-authored-by: Alex Li --- src/community/china/_os-settings.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/community/china/_os-settings.md b/src/community/china/_os-settings.md index d7cf17ebc5b..dd50cd34d4c 100644 --- a/src/community/china/_os-settings.md +++ b/src/community/china/_os-settings.md @@ -5,7 +5,7 @@ {% assign prompt = 'C:\>' -%} {% assign envvarset = 'C:\> $env:' -%} {% assign setpath = 'C:\> $env:PATH = $pwd.PATH + "/flutter/bin",$env:PATH -join ";"' -%} -{% assign comtoset = 'env:' -%} +{% assign comtoset = '$env:' -%} {% assign unzip='Extract-Archive' %} {% capture permaddexample -%} $newPath = $pwd.PATH + "/flutter/bin",$env:PATH -join ";" @@ -33,17 +33,16 @@ EOT {%- if id == 'windows' %} active {% endif %}" role="tabpanel" aria-labelledby="{{id}}-tab" markdown="1"> -1. Create and change into the directory where you plan - to store your local Flutter clone. +1. Open a new Terminal window to prepare running scripts. -1. Set your pub URL to your mirror site. +1. Set `PUB_HOSTED_URL` to your mirror site. In {{shell}}, run the following command: ```terminal {{envvarset}}PUB_HOSTED_URL="https://pub.flutter-io.cn" ``` -1. Set your Flutter storage URL to your mirror site. +1. Set `FLUTTER_STORAGE_BASE_URL` to your mirror site. In {{shell}}, run the following command: ```terminal @@ -51,7 +50,8 @@ EOT ``` 1. Download the Flutter archive from your mirror site. - In your preferred browser, go to https://flutter.cn/docs/release/archive. + In your preferred browser, go to + [Flutter SDK archive](https://flutter.cn/docs/release/archive?tab={{id}}). 1. Create a folder where you can install Flutter. From 078b5cd50739f73a3eac360b16b8dcfa2c743d4c Mon Sep 17 00:00:00 2001 From: Tony Sansone Date: Wed, 1 Nov 2023 14:27:30 -0500 Subject: [PATCH 10/14] Added TUNA --- src/community/china/index.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/community/china/index.md b/src/community/china/index.md index 0a34c51dd8c..c2e6029082b 100644 --- a/src/community/china/index.md +++ b/src/community/china/index.md @@ -185,5 +185,33 @@ $env:PUB_HOSTED_URL="https://mirror.sjtu.edu.cn" $env:FLUTTER_STORAGE_BASE_URL="https://mirror.sjtu.edu.cn/flutter-infra" ``` +#### Tsinghua University TUNA Association + +[Tsinghua University TUNA Association][] +maintains the `mirrors.tuna.tsinghua.edu.cn` mirror. +It includes Flutter and packages. + +If you're running into issues that only occur when +using the `mirror.sjtu.edu.cn` mirror, report the issue to their +[issue tracker](https://github.com/tuna/issues). + +To set your machine to use this mirror, use these commands. + +On macOS, Linux, or ChromeOS: + +```bash +export FLUTTER_STORAGE_BASE_URL=https://mirrors.tuna.tsinghua.edu.cn/flutter +export PUB_HOSTED_URL=https://mirrors.tuna.tsinghua.edu.cn/dart-pub +``` + +On Windows: + +```powershell +$env:PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub" +$env:FLUTTER_STORAGE_BASE_URL="https://mirrors.tuna.tsinghua.edu.cn/flutter" +``` + +[Tsinghua University TUNA Association]: https://tuna.moe + [China Flutter User Group]: https://github.com/cfug [Shanghai Jiao Tong University *nix User Group]: https://github.com/sjtug From 551f432ad09e50d4e2b2fb7fde61ab04c21e1711 Mon Sep 17 00:00:00 2001 From: Alex Li Date: Tue, 7 Nov 2023 22:33:58 +0800 Subject: [PATCH 11/14] Update china-notice.md --- src/_includes/docs/china-notice.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/_includes/docs/china-notice.md b/src/_includes/docs/china-notice.md index fa00ac6c114..611d6b0899c 100644 --- a/src/_includes/docs/china-notice.md +++ b/src/_includes/docs/china-notice.md @@ -1,5 +1,6 @@ {{site.alert.important}} - If you're in China, read [Using Flutter in China][]. + 如果你正在中国的网络环境下配置 Flutter, + 请参考 [在中国网络环境下使用 Flutter][] 文档。 {{site.alert.end}} -[Using Flutter in China]: {{site.url}}/community/china \ No newline at end of file +[在中国网络环境下使用 Flutter]: https://flutter.cn/community/china From f63b25ff34dae9ef4726749c1a736a87f423db95 Mon Sep 17 00:00:00 2001 From: Tony Sansone Date: Wed, 8 Nov 2023 15:46:32 -0600 Subject: [PATCH 12/14] Updates for platform --- src/_data/mirrors.yml | 22 +++ src/assets/js/main.js | 2 + src/community/china/_download-urls.md | 30 ++++ src/community/china/_os-settings.md | 80 ++++++---- src/community/china/_pub-settings.md | 44 ++++++ src/community/china/index.md | 207 ++++++++++---------------- 6 files changed, 227 insertions(+), 158 deletions(-) create mode 100644 src/_data/mirrors.yml create mode 100644 src/community/china/_download-urls.md create mode 100644 src/community/china/_pub-settings.md diff --git a/src/_data/mirrors.yml b/src/_data/mirrors.yml new file mode 100644 index 00000000000..c47295aa0cd --- /dev/null +++ b/src/_data/mirrors.yml @@ -0,0 +1,22 @@ +- group: 'China Flutter User Group' + mirror: 'flutter-io.cn' + urls: + pubhosted: 'https://pub.flutter-io.cn' + flutterstorage: 'https://storage.flutter-io.cn' + issues: 'https://github.com/cfug/flutter.cn/issues/new/choose' + group: https://github.com/cfug +- group: 'Shanghai Jiao Tong University *nix User Group' + mirror: 'mirror.sjtu.edu.cn' + urls: + pubhosted: 'https://mirror.sjtu.edu.cn/flutter-infra' + flutterstorage: 'https://mirror.sjtu.edu.cn' + issues: 'https://github.com/sjtug/mirror-requests' + group: https://github.com/sjtug +- group: 'Tsinghua University TUNA Association' + mirror: 'mirrors.tuna.tsinghua.edu.cn' + urls: + pubhosted: 'https://mirrors.tuna.tsinghua.edu.cn/dart-pub' + flutterstorage: 'https://mirrors.tuna.tsinghua.edu.cn/flutter' + issues: 'https://github.com/tuna/issues' + group: https://tuna.moe + diff --git a/src/assets/js/main.js b/src/assets/js/main.js index 250e00797a5..4b422cc9f1f 100644 --- a/src/assets/js/main.js +++ b/src/assets/js/main.js @@ -22,6 +22,8 @@ document.addEventListener("DOMContentLoaded", function(_) { setupTabs($('#add-to-app-android-deps'), 'dev.flutter.add-to-app.android.deps'); setupTabs($('#ios-versions'), 'dev.flutter.ios-versions'); setupTabs($('#china-os-tabs'), 'dev.flutter.china-os'); + setupTabs($('#china-os-dl-tabs'), 'dev.flutter.china-os-dl'); + setupTabs($('#china-os-pub-tabs'), 'dev.flutter.china-os-pub'); prettyPrint(); }); diff --git a/src/community/china/_download-urls.md b/src/community/china/_download-urls.md new file mode 100644 index 00000000000..e0e54782ec6 --- /dev/null +++ b/src/community/china/_download-urls.md @@ -0,0 +1,30 @@ + +{% assign id = include.ref-os | downcase -%} +{% assign mainpath = include.filepath -%} +{% capture filepath -%}{{mainpath | replace: "opsys", id}}{{file-format}} {% endcapture -%} + +{%- case id %} +{% when 'windows','macos' %} +{%- assign file-format = 'zip' %} +{% else %} +{%- assign file-format = 'tar.xz' %} +{% endcase %} + +
+ +To download the {{include.ref-os}} 3.13 version of the Flutter SDK, +you would change the original URL from: + +```terminal +https://storage.googleapis.com/{{filepath}} +``` + +to the mirror URL: + +```terminal +https://storage.flutter-io.cn/{{filepath}} +``` + +
diff --git a/src/community/china/_os-settings.md b/src/community/china/_os-settings.md index dd50cd34d4c..572286bb0d1 100644 --- a/src/community/china/_os-settings.md +++ b/src/community/china/_os-settings.md @@ -1,49 +1,68 @@ -{% assign id = include.os | downcase -%} +{% assign id = include.ref-os | downcase -%} +{% assign jsonurl = 'https://storage.googleapis.com/flutter_infra_release/releases/releases_{{id}}.json' %} +{% assign os = include.ref-os -%} +{% assign sdk = include.sdk -%} {% if id == 'windows' -%} -{% assign shell = 'Powershell' -%} -{% assign prompt = 'C:\>' -%} -{% assign envvarset = 'C:\> $env:' -%} -{% assign setpath = 'C:\> $env:PATH = $pwd.PATH + "/flutter/bin",$env:PATH -join ";"' -%} -{% assign comtoset = '$env:' -%} -{% assign unzip='Extract-Archive' %} -{% capture permaddexample -%} + {% assign shell = 'Powershell' -%} + {% assign prompt = 'C:\>' -%} + {% assign comtoset = '$env:' -%} + {% assign installdirsuggestion = '%USERPROFILE%\dev' %} + {% capture envvarset -%}{{prompt}} {{comtoset}}{% endcapture -%} + {% capture setpath -%}{{envvarset}}PATH = $pwd.PATH + "/flutter/bin",$env:PATH -join ";"{% endcapture -%} + {% capture newdir -%}{{prompt}} New-Item -Path '{{installdirsuggestion}}' -ItemType Directory{% endcapture -%} + {% capture unzip -%} {{prompt}} Extract-Archive:{% endcapture -%} + {% capture permaddexample -%} $newPath = $pwd.PATH + "/flutter/bin",$env:PATH -join ";" [System.Environment]::SetEnvironmentVariable('Path',$newPath,User) [System.Environment]::SetEnvironmentVariable('PUB_HOSTED_URL','https://pub.flutter-io.cn',User) [System.Environment]::SetEnvironmentVariable('FLUTTER_STORAGE_BASE_URL','https://storage.flutter-io.cn',User) -{% endcapture -%} + {% endcapture -%} {% else -%} -{% assign shell = 'your terminal' -%} -{% assign prompt = '$' -%} -{% assign envvarset = '$ export ' -%} -{% assign setpath = '$ export PATH="$PWD/flutter/bin:$PATH"' -%} -{% assign comtoset = 'export' -%} -{% assign unzip='unzip' %} -{% capture permaddexample -%} + {% assign shell = 'your terminal' -%} + {% assign prompt = '$' -%} + {% assign comtoset = 'export ' -%} + {% assign installdirsuggestion = '`~/dev`' %} + {% capture envvarset -%}{{prompt}} {{comtoset}}{% endcapture -%} + {% capture setpath -%}{{envvarset}}PATH="$PWD/flutter/bin:$PATH"{% endcapture -%} + {% capture newdir -%}{{prompt}} mkdir ~/dev{% endcapture -%} + {% if id == 'macos' %} + {% capture unzip -%} {{prompt}} unzip{% endcapture -%} + {% else %} + {% capture unzip -%} {{prompt}} tar -xf{% endcapture -%} + {% endif %} + {% capture permaddexample -%} cat <> ~/.zprofile {{envvarset}}PUB_HOSTED_URL="https://pub.flutter-io.cn" {{envvarset}}FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn" {{setpath}} EOT -{% endcapture -%} + {% endcapture -%} {% endif -%} +{%- case id %} + {% when 'windows','macos' %} + {%- assign file-format = 'zip' %} + {%- assign download-os = id %} + {% when 'linux','chromeos' %} + {%- assign download-os = 'linux' %} + {%- assign file-format = 'tar.xz' %} +{% endcase %}
-1. Open a new Terminal window to prepare running scripts. +This procedure requires using {{shell}}. + +1. Open a new window in {{shell}} to prepare running scripts. 1. Set `PUB_HOSTED_URL` to your mirror site. - In {{shell}}, run the following command: ```terminal {{envvarset}}PUB_HOSTED_URL="https://pub.flutter-io.cn" ``` 1. Set `FLUTTER_STORAGE_BASE_URL` to your mirror site. - In {{shell}}, run the following command: ```terminal {{envvarset}}FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn" @@ -53,30 +72,29 @@ EOT In your preferred browser, go to [Flutter SDK archive](https://flutter.cn/docs/release/archive?tab={{id}}). -1. Create a folder where you can install Flutter. +1. Create a folder where you can install Flutter. then change into it. - Consider - {% if id == 'windows' -%} - `%USERPROFILE%` or `D:\dev`. - {% else -%} - `~/dev`. - {% endif %} + Consider a path like {{installdirsuggestion}}. + + ```terminal + {{newdir}}; cd {{installdirsuggestion}} + ``` + +1. Extract the the SDK from the {{file-format}} archive file. -1. Extract the zip file. + This example assumes you downloaded the {{os}} version of the Flutter SDK. ```terminal - {{unzip}} flutter_sdk_v1.0.0.zip + {{unzip}} {{sdk | replace: "opsys", download-os}}{{file-format}} ``` 1. Add Flutter to your `PATH` environment variable. - In {{shell}}, run the following command: ```terminal {{setpath}} ``` 1. Run Flutter Doctor to verify your installation. - In {{shell}}, run the following command: ```terminal {{prompt}} flutter doctor diff --git a/src/community/china/_pub-settings.md b/src/community/china/_pub-settings.md new file mode 100644 index 00000000000..6f6cbe6240e --- /dev/null +++ b/src/community/china/_pub-settings.md @@ -0,0 +1,44 @@ + +{% assign id = include.os | downcase -%} + +
+ +1. Configure a proxy. + To configure a proxy, check out the [Dart documentation on proxies][]. + + {% comment %} + From https://github.com/flutter/website/issues/2556#issuecomment-481566476 + {% endcomment %} + +1. Verify that your `PUB_HOSTED_URL` environment variable is either unset + or empty. + + {% if id == 'windows' -%} + + ```terminal + {{prompt}} echo $env:PUB_HOSTED_URL + ``` + + If this command returns any value, unset it. + + ```terminal + {{prompt}} Remove-Item $env:PUB_HOSTED_URL + ``` + + {% else -%} + + ```terminal + {{prompt}} echo $PUB_HOSTED_URL + ``` + + If this command returns any value, unset it. + + ```terminal + {{prompt}} unset $PUB_HOSTED_URL + ``` + + {% endif %} + +
diff --git a/src/community/china/index.md b/src/community/china/index.md index c2e6029082b..3127acb2382 100644 --- a/src/community/china/index.md +++ b/src/community/china/index.md @@ -5,16 +5,19 @@ toc: true os-list: [Windows, macOS, Linux, ChromeOS] --- -{% assign path = 'flutter_infra_release/releases/stable/windows/flutter_windows_3.3.0-stable.zip' -%} +{% assign flutter-sdk = 'flutter_opsys_v3.13.0-stable.' %} +{% capture sdk-path -%}flutter_infra_release/releases/stable/opsys/{{flutter-sdk}}{%- endcapture %} To speed the download and installation of Flutter in China, -consider using a mirror site. +consider using a [mirror site][]. {{site.alert.important}} - Use mirror sites only if you _trust_ the provider. - The Flutter team cannot verify their reliability or security. + Use mirror sites _only_ if you _trust_ the provider. + The Flutter team can't verify their reliability or security. {{site.alert.end}} +[mirror site]: https://en.wikipedia.org/wiki/Mirror_site + ## Use a Flutter mirror site The [China Flutter User Group][] (CFUG) maintains a Simplified Chinese @@ -35,17 +38,16 @@ To set your machine to use a mirror site: {% for os in page.os-list %} {% assign id = os | downcase -%} {% endfor -%} {% comment %} Tab panes {% endcomment -%}
-{% include_relative _os-settings.md os="Windows" %} -{% include_relative _os-settings.md os="macOS" %} -{% include_relative _os-settings.md os="Linux" %} -{% include_relative _os-settings.md os="ChromeOS" %} +{% for os in page.os-list %} +{% include_relative _os-settings.md ref-os=os sdk=flutter-sdk %} +{% endfor -%}
### Download Flutter archives based on a mirrored URL @@ -53,64 +55,60 @@ To set your machine to use a mirror site: To download Flutter archives from a mirrored URL, replace `storage.googleapis.com` with the URL of your trusted mirror. This should improve download speed. - You can use the replaced URL in other applications to download software. +You can use the mirror URL in other applications to download software. -{{site.alert.note}} - Not every mirror supports downloading artifacts using a replaced URL. -{{site.alert.end}} +To change a Google storage site to a CFUG storage site, replace the example +original URL with the example mirror URL. -For example: +{% comment %} Nav tabs {% endcomment -%} + -* Original URL:
- [`https://storage.googleapis.com/{{path}}`](https://storage.googleapis.com/{{path}}) +{% comment %} Tab panes {% endcomment -%} +
+{% for os in page.os-list %} +{% include_relative _download-urls.md ref-os=os filepath=sdk-path %} +{% endfor -%} +
-* Mirrored URL:
- [`https://storage.flutter-io.cn/{{path}}`](https://storage.flutter-io.cn/{{path}}) +{{site.alert.note}} + Not every mirror supports downloading artifacts using their direct URL. +{{site.alert.end}} ## Configure your machine to publish your package -To publish your packages to pub.dev, -you need to be able to access both Google Auth and the pub.dev site. - - {% comment %} - From https://github.com/flutter/website/pull/9338#discussion_r1328077020 - {% endcomment %} - -To publish packages to pub.dev: - -1. Configure a proxy. - To configure a proxy, check out the [Dart documentation on proxies][]. - - {% comment %} - From https://github.com/flutter/website/issues/2556#issuecomment-481566476 - {% endcomment %} - -1. Verify that your `PUB_HOSTED_URL` environment variable is either unset - or empty. - - On macOS, Linux, or ChromeOS, run this command: - - ```bash - echo $PUB_HOSTED_URL - ``` - - If this command returns any value, unset it. +To publish your packages to `pub.dev`, +you need to be able to access both Google Auth and the `pub.dev` site. - ```bash - unset $PUB_HOSTED_URL - ``` +{% comment %} +From https://github.com/flutter/website/pull/9338#discussion_r1328077020 +{% endcomment %} - On Windows, run this command: +To enable access to `pub.dev`: - ```powershell - echo $env:PUB_HOSTED_URL - ``` - - If this command returns any value, unset it. +{% comment %} Nav tabs {% endcomment -%} + - ```powershell - Remove-Item $env:PUB_HOSTED_URL - ``` +{% comment %} Tab panes {% endcomment -%} +
+{% include_relative _pub-settings.md os="Windows" filepath=path %} +{% include_relative _pub-settings.md os="macOS" filepath=path %} +{% include_relative _pub-settings.md os="Linux" filepath=path %} +{% include_relative _pub-settings.md os="ChromeOS" filepath=path %} +
To learn more about publishing packages, check out [Dart documentation on publishing packages][]. @@ -119,99 +117,54 @@ To learn more about publishing packages, check out [Dart documentation on publishing packages]: {{site.dart-site}}/tools/pub/publishing -## Details on mirror sites - -### Support for mirror sites +## Known, trusted community-run mirror sites The Flutter team cannot guarantee long-term availability of any mirrors. You can use other mirrors if they become available. -### Host new mirror sites +{% for mirror in site.data.mirrors %} -If you're interested in setting up your own mirror, -contact [flutter-dev@googlegroups.com](mailto:flutter-dev@googlegroups.com) -for assistance. +
-### Known, trusted community-run mirror sites +### {{mirror.group}} -#### China Flutter User Group +[{{mirror.group}}][] maintains the `{{mirror.mirror}}` mirror. +It includes the Flutter SDK and pub packages. -[China Flutter User Group][] maintains the `flutter-io.cn` mirror. -It includes Flutter and packages. - -If you're running into issues that only occur when -using the `flutter-io.cn` mirror, report the issue to their -[issue tracker (镜像问题)]({{site.github}}/cfug/flutter.cn/issues/new/choose). +#### Configure your machine to use this mirror +{:.no_toc} To set your machine to use this mirror, use these commands. On macOS, Linux, or ChromeOS: -```bash -export PUB_HOSTED_URL=https://pub.flutter-io.cn -export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn +```terminal +export PUB_HOSTED_URL={{mirror.urls.pubhosted}}; +export FLUTTER_STORAGE_BASE_URL={{mirror.urls.flutterstorage}} ``` On Windows: -```powershell -$env:PUB_HOSTED_URL="https://pub.flutter-io.cn" -$env:FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn" +```terminal +$env:PUB_HOSTED_URL="{{mirror.urls.pubhosted}}"; +$env:FLUTTER_STORAGE_BASE_URL="{{mirror.urls.flutterstorage}}" ``` -#### Shanghai Jiao Tong University *nix User Group - -[Shanghai Jiao Tong University *nix User Group][] -maintains the `mirror.sjtu.edu.cn` mirror. -It includes Flutter and packages. +#### Get support for this mirror +{:.no_toc} If you're running into issues that only occur when -using the `mirror.sjtu.edu.cn` mirror, report the issue to their -[issue tracker (议题)](https://github.com/sjtug/mirror-requests). +using the `{{mirror.mirror}}` mirror, report the issue to their +[issue tracker]({{mirror.urls.issues}}). -To set your machine to use this mirror, use these commands. +{% endfor %} -On macOS, Linux, or ChromeOS: - -```bash -export FLUTTER_STORAGE_BASE_URL=https://mirror.sjtu.edu.cn -export PUB_HOSTED_URL=https://mirror.sjtu.edu.cn/flutter-infra -``` - -On Windows: - -```powershell -$env:PUB_HOSTED_URL="https://mirror.sjtu.edu.cn" -$env:FLUTTER_STORAGE_BASE_URL="https://mirror.sjtu.edu.cn/flutter-infra" -``` +{% for mirror in site.data.mirrors %} +[{{mirror.group}}]: {{mirror.urls.group}} +{% endfor %} -#### Tsinghua University TUNA Association +## Offer to host a new mirror site -[Tsinghua University TUNA Association][] -maintains the `mirrors.tuna.tsinghua.edu.cn` mirror. -It includes Flutter and packages. - -If you're running into issues that only occur when -using the `mirror.sjtu.edu.cn` mirror, report the issue to their -[issue tracker](https://github.com/tuna/issues). - -To set your machine to use this mirror, use these commands. - -On macOS, Linux, or ChromeOS: - -```bash -export FLUTTER_STORAGE_BASE_URL=https://mirrors.tuna.tsinghua.edu.cn/flutter -export PUB_HOSTED_URL=https://mirrors.tuna.tsinghua.edu.cn/dart-pub -``` - -On Windows: - -```powershell -$env:PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub" -$env:FLUTTER_STORAGE_BASE_URL="https://mirrors.tuna.tsinghua.edu.cn/flutter" -``` - -[Tsinghua University TUNA Association]: https://tuna.moe - -[China Flutter User Group]: https://github.com/cfug -[Shanghai Jiao Tong University *nix User Group]: https://github.com/sjtug +If you're interested in setting up your own mirror, +contact [flutter-dev@googlegroups.com](mailto:flutter-dev@googlegroups.com) +for assistance. From c1967d731bc364739bf7a68a9476d6abdd6b6697 Mon Sep 17 00:00:00 2001 From: Tony Sansone Date: Mon, 13 Nov 2023 12:26:38 -0600 Subject: [PATCH 13/14] Integrated last changes --- src/_includes/docs/china-notice.md | 4 +++- src/community/china/index.md | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/_includes/docs/china-notice.md b/src/_includes/docs/china-notice.md index 611d6b0899c..734daca95f5 100644 --- a/src/_includes/docs/china-notice.md +++ b/src/_includes/docs/china-notice.md @@ -1,6 +1,8 @@ {{site.alert.important}} 如果你正在中国的网络环境下配置 Flutter, - 请参考 [在中国网络环境下使用 Flutter][] 文档。 + 请参考 [在中国网络环境下使用 Flutter][] 文档. +
This site provides [this guide in English]. {{site.alert.end}} [在中国网络环境下使用 Flutter]: https://flutter.cn/community/china +[this guide in English]: {{site.url}}/community/china diff --git a/src/community/china/index.md b/src/community/china/index.md index 3127acb2382..63900433a22 100644 --- a/src/community/china/index.md +++ b/src/community/china/index.md @@ -1,6 +1,6 @@ --- title: Using Flutter in China -description: Where to find a version of the Flutter site that is localized to Simplified Chinese. +description: How to use, access, and learn about Flutter in China. toc: true os-list: [Windows, macOS, Linux, ChromeOS] --- @@ -9,7 +9,7 @@ os-list: [Windows, macOS, Linux, ChromeOS] {% capture sdk-path -%}flutter_infra_release/releases/stable/opsys/{{flutter-sdk}}{%- endcapture %} To speed the download and installation of Flutter in China, -consider using a [mirror site][]. +consider using a [mirror site][] or _mirror_. {{site.alert.important}} Use mirror sites _only_ if you _trust_ the provider. @@ -110,7 +110,7 @@ To enable access to `pub.dev`: {% include_relative _pub-settings.md os="ChromeOS" filepath=path %}
-To learn more about publishing packages, check out +To learn more about publishing packages, check out the [Dart documentation on publishing packages][]. [Dart documentation on proxies]: {{site.dart-site}}/tools/pub/troubleshoot#pub-get-fails-from-behind-a-corporate-firewall @@ -119,7 +119,7 @@ To learn more about publishing packages, check out ## Known, trusted community-run mirror sites -The Flutter team cannot guarantee long-term availability of any mirrors. +The Flutter team can't guarantee long-term availability of any mirrors. You can use other mirrors if they become available. {% for mirror in site.data.mirrors %} From e7491d2289b01c2958924732c93be0a1ca1aeda8 Mon Sep 17 00:00:00 2001 From: Tony Sansone Date: Tue, 14 Nov 2023 11:21:04 -0600 Subject: [PATCH 14/14] Updated per @parlough review --- src/_includes/docs/china-notice-cn.md | 6 ++++++ src/_includes/docs/china-notice.md | 7 ++----- src/community/china/_download-urls.md | 9 +++++++-- src/community/china/_os-settings.md | 2 +- src/community/china/index.md | 17 +++++++++++------ 5 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 src/_includes/docs/china-notice-cn.md diff --git a/src/_includes/docs/china-notice-cn.md b/src/_includes/docs/china-notice-cn.md new file mode 100644 index 00000000000..69b0262b44a --- /dev/null +++ b/src/_includes/docs/china-notice-cn.md @@ -0,0 +1,6 @@ +{{site.alert.secondary}} + 如果你正在中国的网络环境下配置 Flutter, + 请参考 [在中国网络环境下使用 Flutter][] 文档. +{{site.alert.end}} + +[在中国网络环境下使用 Flutter]: https://flutter.cn/community/china \ No newline at end of file diff --git a/src/_includes/docs/china-notice.md b/src/_includes/docs/china-notice.md index 734daca95f5..cf99bd7f3ab 100644 --- a/src/_includes/docs/china-notice.md +++ b/src/_includes/docs/china-notice.md @@ -1,8 +1,5 @@ {{site.alert.important}} - 如果你正在中国的网络环境下配置 Flutter, - 请参考 [在中国网络环境下使用 Flutter][] 文档. -
This site provides [this guide in English]. + If you develop apps in China, check out [using Flutter in China][]. {{site.alert.end}} -[在中国网络环境下使用 Flutter]: https://flutter.cn/community/china -[this guide in English]: {{site.url}}/community/china +[using Flutter in China]: {{site.url}}/community/china diff --git a/src/community/china/_download-urls.md b/src/community/china/_download-urls.md index e0e54782ec6..16893d7a5b1 100644 --- a/src/community/china/_download-urls.md +++ b/src/community/china/_download-urls.md @@ -1,14 +1,19 @@ {% assign id = include.ref-os | downcase -%} {% assign mainpath = include.filepath -%} -{% capture filepath -%}{{mainpath | replace: "opsys", id}}{{file-format}} {% endcapture -%} - {%- case id %} {% when 'windows','macos' %} {%- assign file-format = 'zip' %} {% else %} {%- assign file-format = 'tar.xz' %} {% endcase %} +{%- if id == 'chromeos' %} +{% assign plat = 'linux' %} +{%- else %} +{% assign plat = id %} +{% endif %} +{% capture filepath -%}{{mainpath | replace: "opsys", plat}}{{file-format}} {% endcapture -%} +
-### Download Flutter archives based on a mirrored URL +### Download Flutter archives based on a mirror site -To download Flutter archives from a mirrored URL, +To download Flutter from the [SDK archive][] from a mirror, replace `storage.googleapis.com` with the URL of your trusted mirror. +Use your mirror site in the browser or in other applications +like IDM or Thunder. This should improve download speed. -You can use the mirror URL in other applications to download software. -To change a Google storage site to a CFUG storage site, replace the example -original URL with the example mirror URL. +[SDK archive]: {{site.url}}/release/archive + +The following example shows how to change the URL for Flutter's download site +from Google's archive to CFUG's mirror. {% comment %} Nav tabs {% endcomment -%}