Skip to content

Commit f7e0e6e

Browse files
authored
Merge pull request #422 from GoogleChrome/revert-to-pwaid
We are temporarly going back to URLs with ID
2 parents 0bb7605 + c64d934 commit f7e0e6e

File tree

3 files changed

+12
-23
lines changed

3 files changed

+12
-23
lines changed

controllers/pwa.js

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -204,26 +204,15 @@ router.post('/add', (req, res, next) => {
204204
* Display a PWA or redirects to the encodedStartUrl of the PWA.
205205
*/
206206
router.get('/:pwa', (req, res, next) => {
207-
if (isNaN(Number(req.params.pwa))) {
208-
// This URL is not a number, assume encodedStartUrl.
209-
renderOnePwa(req, res)
210-
.then(html => {
211-
res.send(html);
212-
})
213-
.catch(err => {
214-
err.status = 404;
215-
return next(err);
216-
});
217-
return;
218-
}
219-
220-
// Otherwise, redirect to /pwas/<encodedStartUrl>.
221-
pwaLib.find(req.params.pwa).then(pwa => {
222-
res.redirect(301, req.baseUrl + '/' + pwa.encodedStartUrl);
223-
}).catch(err => {
224-
err.status = 404;
225-
return next(err);
226-
});
207+
renderOnePwa(req, res)
208+
.then(html => {
209+
res.send(html);
210+
})
211+
.catch(err => {
212+
err.status = 404;
213+
return next(err);
214+
});
215+
return;
227216
});
228217

229218
/**
@@ -233,7 +222,7 @@ function renderOnePwa(req, res) {
233222
const url = req.originalUrl;
234223
const pwaId = encodeURIComponent(req.params.pwa); // we have foo/ here, need foo%2F
235224
const contentOnly = false || req.query.contentOnly;
236-
return pwaLib.findByEncodedStartUrl(pwaId)
225+
return pwaLib.find(pwaId)
237226
.then(pwa => {
238227
return lighthouseLib.findByPwaId(pwaId)
239228
.then(lighthouse => {

public/sw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ toolbox.options.debug = false;
1111

1212
importScripts('/js/sw-assets-precache.js'); /* global ASSETS */
1313

14-
const VERSION = '7';
14+
const VERSION = '8';
1515
const PREFIX = 'gulliver';
1616
const CACHE_NAME = `${PREFIX}-v${VERSION}`;
1717
const PWA_OPTION = {

views/pwas/list.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
<div class="items">
3434
{{#each pwas}}
35-
<a id="{{id}}" class="item card-pwa offline-aware gulliver-content-only box-shadow" href="/pwas/{{encodedStartUrl}}" style="background-color: {{backgroundColor}}; color:{{contrastColor backgroundColor}}">
35+
<a id="{{id}}" class="item card-pwa offline-aware gulliver-content-only box-shadow" href="/pwas/{{id}}" style="background-color: {{backgroundColor}}; color:{{contrastColor backgroundColor}}">
3636
{{#if iconUrl64}}
3737
<img class="pwa-icon" src="{{iconUrl64}}" srcset="{{iconUrl64}} 1x, {{iconUrl128}} 2x" width="64" height="64" alt="logo for {{displayName}}"/>
3838
{{else}}

0 commit comments

Comments
 (0)