-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
76 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
- image: circleci/node:10.7.0 | ||
working_directory: ~/app | ||
steps: | ||
- checkout | ||
- run: yarn install | ||
- run: yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules/ | ||
release/dist/ | ||
.DS_Store | ||
yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
# Ku-nya | ||
Ku-nya is Chrome Extension for pixiv lovers. It picks up illustrations on the pixiv ranking randomly and displays them on your new tab. | ||
|
||
|
||
## Build | ||
|
||
```bash | ||
yarn install | ||
yarn build | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const refererValue = 'https://www.pixiv.net/' | ||
const refererTarget = 'https://i.pximg.net/*' | ||
|
||
/** Modifies request Referer HTTP header */ | ||
chrome.webRequest.onBeforeSendHeaders.addListener( | ||
details => { | ||
let refererFound = false | ||
|
||
for (const n in details.requestHeaders) { | ||
refererFound = details.requestHeaders[n].name.toLowerCase() == 'referer' | ||
|
||
if (refererFound) { | ||
// Rewrite Referer header | ||
details.requestHeaders[n].value = refererValue | ||
break | ||
} | ||
} | ||
|
||
if (!refererFound) { | ||
// If no referer header is set, set one | ||
details.requestHeaders.push({ name: 'Referer', value: refererValue }) | ||
} | ||
return { requestHeaders: details.requestHeaders } | ||
}, | ||
{ | ||
urls: [refererTarget], | ||
}, | ||
['requestHeaders', 'blocking'], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters