安裝與設定方式
- 先在 Mac 上安裝並開啟 Glanceway,再使用上方的安裝連結。
- 點選「安裝到 Glanceway」。若瀏覽器無法開啟應用程式,下載 .gwsrc 檔案並在資訊源管理中匯入。
- 填寫以下必填欄位並儲存,設定更新間隔,等待首次成功取得內容。
設定檢查
API_TOKEN— 必填. Product Hunt Developer Token (get one at https://api.producthunt.com/v2/oauth/applications) 填寫自己的存取憑證,請勿在截圖或公開檔案中分享。
沒有顯示內容時如何排查
- 對照目前版本設定表檢查欄位、清單項目與憑證。下方範例不包含可用的真實憑證。
- 檢查網路及上游服務狀態。認證失敗或速率限制可能使更新失敗,請依上游限制調整間隔。
- 空清單也可能代表沒有符合條件的條目。內容與更新時間取決於資料提供方及資訊源實作。
設定項目
| 名稱 | 鍵 | 類型 | 必填 | 預設值 | 描述 |
|---|---|---|---|---|---|
| API Token | API_TOKEN | secret | 是 | — | Product Hunt Developer Token (get one at https://api.producthunt.com/v2/oauth/applications) |
原始碼
id: codytseng/product-hunt
version: 1.0.0
name: Product Hunt
description: Today's top products from Product Hunt
author: codytseng
author_url: https://github.com/codytseng
category: News
tags:
- producthunt
- products
- startups
config:
- key: API_TOKEN
name: API Token
type: secret
required: true
description: Product Hunt Developer Token (get one at https://api.producthunt.com/v2/oauth/applications) id: codytseng/product-hunt
version: 1.0.0
name: Product Hunt
description: Today's top products from Product Hunt
author: codytseng
author_url: https://github.com/codytseng
category: News
tags:
- producthunt
- products
- startups
config:
- key: API_TOKEN
name: API Token
type: secret
required: true
description: Product Hunt Developer Token (get one at https://api.producthunt.com/v2/oauth/applications) module.exports = async (api) => {
const token = api.config.get("API_TOKEN");
async function fetchData() {
const query = `{
posts(order: RANKING) {
edges {
node {
id
name
tagline
url
votesCount
createdAt
}
}
}
}`;
const response = await api.fetch("https://api.producthunt.com/v2/api/graphql", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ query }),
});
if (!response.ok || !response.json) {
throw new Error(`Failed to fetch Product Hunt posts (HTTP ${response.status})`);
}
api.emit(
response.json.data.posts.edges.map((edge) => ({
id: edge.node.id,
title: edge.node.name,
subtitle: edge.node.tagline,
url: edge.node.url,
timestamp: edge.node.createdAt,
})),
);
}
await fetchData();
return {
refresh: fetchData,
};
}; module.exports = async (api) => {
const token = api.config.get("API_TOKEN");
async function fetchData() {
const query = `{
posts(order: RANKING) {
edges {
node {
id
name
tagline
url
votesCount
createdAt
}
}
}
}`;
const response = await api.fetch("https://api.producthunt.com/v2/api/graphql", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ query }),
});
if (!response.ok || !response.json) {
throw new Error(`Failed to fetch Product Hunt posts (HTTP ${response.status})`);
}
api.emit(
response.json.data.posts.edges.map((edge) => ({
id: edge.node.id,
title: edge.node.name,
subtitle: edge.node.tagline,
url: edge.node.url,
timestamp: edge.node.createdAt,
})),
);
}
await fetchData();
return {
refresh: fetchData,
};
}; 相關資料來源
Earthquake Alerts
新聞Recent significant earthquakes worldwide from USGS
#earthquake #alerts #science
Hacker News
新聞Top stories from Hacker News
#news #tech #programming
PTT 热门文章
新聞台湾最大 BBS — PTT 的热门看板文章
#ptt #taiwan #chinese #bbs
Spaceflight News
新聞Latest space and spaceflight news articles from SNAPI
#space #science #spaceflight