Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ yarn.lock
node_modules
react-scratch

# Local env files
.env*.local

# Generated sitemaps
public/sitemap*.xml
2 changes: 1 addition & 1 deletion src/components/mbs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function MBS({
<div
className="next-cate-subjects-list"
onClick={() => {
toggleYearChoose("Mathematics (9231)")
toggleYearChoose("Mathematics Further (9231)")
}}>
<h2>Further Mathematics</h2>
<p>
Expand Down
37 changes: 17 additions & 20 deletions src/config.jsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,35 @@
const API_BASE_URL =
process.env.NEXT_PUBLIC_API_BASE_URL || "https://node.snapaper.com"

const api = (path) => `${API_BASE_URL}${path}`

export default {
apiUrl: {
cates: {
alevel: "https://node.snapaper.com/api/cates/ppca/as-and-a-level/",
igcse: "https://node.snapaper.com/api/cates/ppca/igcse/",
// alevel: "https://node.snapaper.com/api/cates/a-levels/",
// igcse: "https://node.snapaper.com/api/cates/cambridge-IGCSE/",
// alevel: "https://node.snapaper.com/api/cates/ppco/A-Level/",
// igcse: "https://node.snapaper.com/api/cates/ppco/IGCSE/",
alevel: api("/api/cates/ppca/as-and-a-level/"),
igcse: api("/api/cates/ppca/igcse/"),
},
papers: {
xyz: {
alevel: "https://node.snapaper.com/api/papers/xyz/A%20Levels/",
igcse: "https://node.snapaper.com/api/papers/xyz/IGCSE/",
alevel: api("/api/papers/xyz/A%20Levels/"),
igcse: api("/api/papers/xyz/IGCSE/"),
},
com: {
alevel: "https://node.snapaper.com/api/papers/com/a-levels/",
igcse: "https://node.snapaper.com/api/papers/com/cambridge-IGCSE/",
alevel: api("/api/papers/com/a-levels/"),
igcse: api("/api/papers/com/cambridge-IGCSE/"),
},
ppco: {
alevel: "https://node.snapaper.com/api/papers/ppco/A-Level/",
igcse: "https://node.snapaper.com/api/papers/ppco/IGCSE/",
alevel: api("/api/papers/ppco/A-Level/"),
igcse: api("/api/papers/ppco/IGCSE/"),
},
ppca: {
alevel: "https://node.snapaper.com/api/papers/ppca/as-and-a-level/",
igcse: "https://node.snapaper.com/api/papers/ppca/igcse/",
alevel: api("/api/papers/ppca/as-and-a-level/"),
igcse: api("/api/papers/ppca/igcse/"),
},
},
years: {
alevel: "https://node.snapaper.com/api/years/ppca/as-and-a-level/",
igcse: "https://node.snapaper.com/api/years/ppca/igcse/",
// alevel: "https://node.snapaper.com/api/years/a-levels/",
// igcse: "https://node.snapaper.com/api/years/cambridge-IGCSE/",
// alevel: "https://node.snapaper.com/api/years/ppco/A-Level/",
// igcse: "https://node.snapaper.com/api/years/ppco/IGCSE/",
alevel: api("/api/years/ppca/as-and-a-level/"),
igcse: api("/api/years/ppca/igcse/"),
},
},
}
5 changes: 4 additions & 1 deletion src/utilities/file-download.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export const downloadFile = (srcUrl) => {
const link = `https://files.snapaper.com/download?filename=${srcUrl}`
let link = `https://files.snapaper.com/download?filename=${srcUrl}`
if (srcUrl.includes(window.location.hostname)) {
link = `${srcUrl}?download=1`
}
const iframe = document.createElement("iframe")
iframe.setAttribute("id", new Date().getTime())
iframe.setAttribute("sandbox", "allow-downloads allow-scripts")
Expand Down
Loading