Skip to content

Commit 8e221c9

Browse files
authored
growth(idea-market): publish noindex per-idea share landing (#1)
* growth(idea-market): add privacy-safe public HTTPS deep link landing * growth(idea-market): add privacy-safe public HTTPS deep link landing * test(idea-market): safeguard public share landing and fallback * test(idea-market): safeguard public share landing and fallback
1 parent a4f1a5e commit 8e221c9

4 files changed

Lines changed: 100 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Idea Market Share Landing QA
2+
on:
3+
pull_request:
4+
paths:
5+
- share/idea-market/**
6+
- tests/idea-market-share.test.mjs
7+
- .github/workflows/idea-market-share-qa.yml
8+
push:
9+
branches: [main]
10+
paths:
11+
- share/idea-market/**
12+
- tests/idea-market-share.test.mjs
13+
- .github/workflows/idea-market-share-qa.yml
14+
permissions:
15+
contents: read
16+
jobs:
17+
test:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 5
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
sparse-checkout: |
24+
share/idea-market
25+
tests/idea-market-share.test.mjs
26+
sparse-checkout-cone-mode: true
27+
- uses: actions/setup-node@v4
28+
with:
29+
node-version: '22'
30+
- run: node --test tests/idea-market-share.test.mjs

‎share/idea-market/index.html‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<meta name="robots" content="noindex,nofollow">
7+
<meta name="referrer" content="no-referrer">
8+
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none';">
9+
<title>Open an Idea Market idea | SK APPS</title>
10+
<style>
11+
:root{font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color-scheme:light}
12+
*{box-sizing:border-box}body{margin:0;min-height:100vh;display:grid;place-items:center;background:#f4f5ff;color:#252144}
13+
main{width:min(100% - 32px,460px);padding:32px 24px;background:white;border-radius:20px;box-shadow:0 12px 38px #15112a16;text-align:center}
14+
h1{font-size:1.65rem;margin:0 0 12px}p{line-height:1.5;color:#595475}
15+
a.action{display:block;margin:14px 0;padding:14px 18px;border-radius:12px;text-decoration:none;font-weight:700;background:#6536c9;color:white}
16+
a.secondary{background:#f2edff;color:#5133ac}
17+
small{display:block;margin-top:16px;color:#656078}#error{color:#a12c47}
18+
</style>
19+
<script src="referral.js" defer></script>
20+
</head>
21+
<body>
22+
<main>
23+
<h1 id="title">A friend shared an idea</h1>
24+
<p id="intro">Explore this idea in Idea Market. Paid or private details are never shown on this page.</p>
25+
<p id="error" role="status" hidden>We couldn't read this invitation. Please ask your friend to share it again.</p>
26+
<a id="open-app" class="action" href="#" hidden>Open this idea in the app</a>
27+
<a class="action secondary" href="https://play.google.com/store/apps/details?id=jp.appdevelopsk.ideamarket">Install Idea Market on Google Play</a>
28+
<a class="action secondary" href="https://appdevelopsk.com/apps">Explore SK APPS</a>
29+
<small>After installing, return to the shared link to open the idea.</small>
30+
</main>
31+
</body>
32+
</html>

‎share/idea-market/referral.js‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
// This static landing does NOT request idea details and does not track tokens.
3+
// Only harmless alphanumeric IDs are used to build an app-specific URI.
4+
(() => {
5+
const id = new URLSearchParams(location.search).get('id') ?? '';
6+
const validId = /^[a-zA-Z0-9_-]{1,96}$/.test(id);
7+
const open = document.getElementById('open-app');
8+
const error = document.getElementById('error');
9+
if (validId) {
10+
open.href = 'ideamarket://open/ideas/' + encodeURIComponent(id);
11+
open.hidden = false;
12+
} else {
13+
error.hidden = false;
14+
}
15+
if (navigator.language?.toLowerCase().startsWith('ja')) {
16+
document.getElementById('title').textContent = 'アイデアが共有されました';
17+
document.getElementById('intro').textContent = 'Idea Marketアプリで共有されたアイデアを開けます。購入前の非公開情報はこのページに表示しません。';
18+
open.textContent = 'アプリでアイデアを開く';
19+
error.textContent = '共有リンクを確認できません。もう一度共有してもらってください。';
20+
}
21+
})();

‎tests/idea-market-share.test.mjs‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import test from 'node:test';
2+
import assert from 'node:assert/strict';
3+
import {readFileSync} from 'node:fs';
4+
const html=readFileSync(new URL('../share/idea-market/index.html',import.meta.url),'utf8');
5+
const js=readFileSync(new URL('../share/idea-market/referral.js',import.meta.url),'utf8');
6+
test('share page gives real Play acquisition fallback and an explicit app open',()=>{
7+
assert.match(html,/play\.google\.com\/store\/apps\/details\?id=jp\.appdevelopsk\.ideamarket/);
8+
assert.match(html,/id="open-app"/);
9+
assert.match(html,/script src="referral\.js"/);
10+
assert.match(html,/noindex,nofollow/);
11+
});
12+
test('identifiers cannot inject scripts or arbitrary external redirects',()=>{
13+
assert.match(js,/\[a-zA-Z0-9_-\]\{1,96\}/);
14+
assert.match(js,/encodeURIComponent\(id\)/);
15+
assert.match(js,/ideamarket:\/\/open\/ideas\//);
16+
assert.doesNotMatch(js,/innerHTML|window\.location\s*=|fetch\(/);
17+
});

0 commit comments

Comments
 (0)