Remove polymer 1 related entries from server.go

Change-Id: Ib2aa0ea01e0047e4d3da698f7d9753c63f3c39c1
This commit is contained in:
Tao Zhou 2019-12-18 13:01:52 +01:00
parent d8d51884e4
commit 0c6f555f64
2 changed files with 5 additions and 8 deletions

View File

@ -46,6 +46,9 @@ simply execute:
```sh
./polygerrit-ui/run-server.sh
// or
npm run start
```
Then visit <http://localhost:8081>.
@ -185,7 +188,7 @@ npm run polylint
## Template Type Safety
> **Warning**: This feature is temporary disabled, because it doesn't work with Polymer 2 and Polymer 3.
> **Warning**: This feature is temporary disabled, because it doesn't work with Polymer 2 and Polymer 3.
Some of the checks are made by polymer linter.

View File

@ -43,8 +43,6 @@ var (
host = flag.String("host", "gerrit-review.googlesource.com", "Host to proxy requests to")
scheme = flag.String("scheme", "https", "URL scheme")
cdnPattern = regexp.MustCompile("https://cdn.googlesource.com/polygerrit_ui/[0-9.]*")
webComponentPattern = regexp.MustCompile("webcomponentsjs-p2")
grAppPattern = regexp.MustCompile("gr-app-p2")
bundledPluginsPattern = regexp.MustCompile("https://cdn.googlesource.com/polygerrit_assets/[0-9.]*")
)
@ -189,13 +187,9 @@ func rewriteHostPage(reader io.Reader) io.Reader {
buf.ReadFrom(reader)
original := buf.String()
// Replace the webcomponentsjs-p2 with webcomponentsjs
replaced := webComponentPattern.ReplaceAllString(original, "webcomponentsjs")
replaced = grAppPattern.ReplaceAllString(replaced, "gr-app")
// Simply remove all CDN references, so files are loaded from the local file system or the proxy
// server instead.
replaced = cdnPattern.ReplaceAllString(replaced, "")
replaced := cdnPattern.ReplaceAllString(original, "")
// Modify window.INITIAL_DATA so that it has the same effect as injectLocalPlugins. To achieve
// this let's add JavaScript lines at the end of the <script>...</script> snippet that also