Skip to content

Commit

Permalink
Remove oauth subdomain
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillweston committed May 6, 2024
1 parent bfd1f62 commit 546cbeb
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 22 deletions.
1 change: 0 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ jobs:
CONTRACT_ADDRESS: ${{ secrets.CONTRACT_ADDRESS }}
AUTH_WEB_ADDRESS: ${{ secrets.AUTH_WEB_ADDRESS }}
TURNSTILE_SITE_KEY: ${{ secrets.TURNSTILE_SITE_KEY }}
RECIPIENT_WEB_ADDRESS: ${{ secrets.RECIPIENT_WEB_ADDRESS }}
AIRDROP_PER_TRANSACTION: ${{ secrets.AIRDROP_PER_TRANSACTION }}
EMAIL_TOKEN: ${{ secrets.EMAIL_TOKEN }}
EMAIL_SERVICE_ID: ${{ secrets.EMAIL_SERVICE_ID }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ jobs:
CONTRACT_ADDRESS: ${{ secrets.CONTRACT_ADDRESS }}
AUTH_WEB_ADDRESS: ${{ secrets.AUTH_WEB_ADDRESS }}
TURNSTILE_SITE_KEY: ${{ secrets.TURNSTILE_SITE_KEY }}
RECIPIENT_WEB_ADDRESS: ${{ secrets.RECIPIENT_WEB_ADDRESS }}
AIRDROP_PER_TRANSACTION: ${{ secrets.AIRDROP_PER_TRANSACTION }}
EMAIL_TOKEN: ${{ secrets.EMAIL_TOKEN }}
EMAIL_SERVICE_ID: ${{ secrets.EMAIL_SERVICE_ID }}
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,10 @@ jobs:
- name: Replace Port in worker.js
run: |
WORKER_NAME=${{ secrets.CLOUDFLARE_WORKER_NAME || 'api' }}
AIRDROP_PORT=${{ secrets.AIRDROP_SERVER_HTTP_PORT || '8080' }}
AIRDROP_PORT2=${{ secrets.AIRDROP_SERVER_HTTP_PORT2 || '8081' }}
TWITTER_PORT=${{ secrets.TWITTER_SERVER_HTTP_PORT || '5000' }}
TWITTER_PORT2=${{ secrets.TWITTER_SERVER_HTTP_PORT2 || '5001' }}
GANACHE_PORT=${{ secrets.GANACHE_HTTP_PORT || '8546' }}
sed -i "s/__AIRDROP_SERVER_HTTP_PORT__/$AIRDROP_PORT/g" worker.js
sed -i "s/__AIRDROP_SERVER_HTTP_PORT2__/$AIRDROP_PORT2/g" worker.js
sed -i "s/__TWITTER_SERVER_HTTP_PORT__/$TWITTER_PORT/g" worker.js
sed -i "s/__TWITTER_SERVER_HTTP_PORT2__/$TWITTER_PORT2/g" worker.js
sed -i "s/__GANACHE_HTTP_PORT__/$GANACHE_PORT/g" worker.js
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ To successfully deploy and run the project locally, you need to create a `contra
"airdropPerTransaction": "Your_Airdrop_Per_Transaction",
"authWebAddress": "Your_Web_Address",
"turnstileSiteKey": "Your_CloudFlare_Turnstile_Site_Key",
"recipientWebAddress": "Your_Receipient_Web_Address",
"emailToken": "Your_Email_Token",
"emailServiceID": "Your_Email_Service_ID",
"emailTemplate": "Your_Email_Template",
Expand All @@ -222,7 +221,6 @@ To successfully deploy and run the project locally, you need to create a `contra
- Replace `Your_Airdrop_Per_Transaction` with the actual value of the airdrop per transaction.
- Replace `Your_Web_Address` with the web address for airdrop eligibility check.
- Replace `Your_CloudFlare_Turnstile_Site_Key` with the site key for the Cloudflare Turnstile widget.
- Replace `Your_Recipient_Web_Address` with the web address for recipient count.
- Replace `Your_Email_Token` with the token for sending emails.
- Replace `Your_Email_Service_ID` with the service ID for sending emails, for example: `lotso_email`.
- Replace `Your_Email_Template` with the email template name, for example: `lotso_email_template`.
Expand Down Expand Up @@ -254,9 +252,8 @@ Here is an example of what your `contract-config.json` might look like for the B
"activeNetwork": "baseMainnet",
"contractAddress": "0x123abc456def789ghi",
"airdropPerTransaction": "100000",
"authWebAddress": "https://oauth.btiplatform.com",
"authWebAddress": "https://api.btiplatform.com",
"turnstileSiteKey": "0x123abc456def789ghi",
"recipientWebAddress": "https://api.btiplatform.com/v1/info/recipients_count",
"emailToken": "0x123abc456def789ghi",
"emailServiceID": "lotso_email",
"emailTemplate": "lotso_email_template",
Expand Down Expand Up @@ -284,7 +281,6 @@ This section provides guidance on deploying your project to GitHub Pages and Clo
|**`PROJECT_ID`**|Essential|A unique identifier obtained from WalletConnect, used for WalletConnect API calls.|
|**`TURNSTILE_SITE_KEY`**|Essential|The site key for Cloudflare's Turnstile service, used for bot protection and CAPTCHA verification.|
|**`AUTH_WEB_ADDRESS`**|Essential|The backend URL of the authentication function, used for verifying user credentials.|
|**`RECIPIENT_WEB_ADDRESS`**|Essential|The backend URL of the recipient function, better to use the specified domain for the project for clearer identification.|
|**`AIRDROP_PER_TRANSACTION`**|Essential|The amount of airdrop per transaction, usually in the form of a string (e.g., "100000").|
|**`EMAIL_TOKEN`**|Essential|The token for sending emails|
|**`EMAIL_SERVICE_ID`**|Essential|The service ID for sending emails|
Expand Down Expand Up @@ -342,7 +338,6 @@ This section provides guidance on deploying your project to GitHub Pages and Clo
3. Add the following custom domains for the worker to route traffic accordingly.
- `api.btiplatform.com`
- `api-dev.btiplatform.com`
- `oauth.btiplatform.com`

### Deploying to Cloudflare Pages

Expand Down
1 change: 0 additions & 1 deletion create-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const config = {
"contractAddress": process.env.CONTRACT_ADDRESS,
"authWebAddress": process.env.AUTH_WEB_ADDRESS,
"turnstileSiteKey": process.env.TURNSTILE_SITE_KEY,
"recipientWebAddress": process.env.RECIPIENT_WEB_ADDRESS,
"airdropPerTransaction": process.env.AIRDROP_PER_TRANSACTION,
"emailToken": process.env.EMAIL_TOKEN,
"emailServiceID": process.env.EMAIL_SERVICE_ID,
Expand Down
2 changes: 1 addition & 1 deletion js/airdrop-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ document.addEventListener('DOMContentLoaded', function() {
})
.then(jsonConfig => {
// Access properties
webAddress = jsonConfig.recipientWebAddress;
webAddress = jsonConfig.authWebAddress + '/v1/info/recipients_count';
airdropPerTransaction = parseInt(jsonConfig.airdropPerTransaction, 10);

// Additional validation can be performed here as needed
Expand Down
10 changes: 2 additions & 8 deletions worker/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,12 @@ async function handleRequest(request) {
url.protocol = 'https:';

// Check the request hostname and set the corresponding backend host and port
if (url.hostname === 'oauth.btiplatform.com') {
if (url.hostname === 'api.btiplatform.com') {
url.hostname = 'host.btiplatform.com';
url.port = '__TWITTER_SERVER_HTTP_PORT__';
} else if (url.hostname === 'oauth-dev.btiplatform.com') {
url.hostname = 'host.btiplatform.com';
url.port = '__TWITTER_SERVER_HTTP_PORT2__';
} else if (url.hostname === 'api.btiplatform.com') {
url.hostname = 'host.btiplatform.com';
url.port = '__AIRDROP_SERVER_HTTP_PORT__';
} else if (url.hostname === 'api-dev.btiplatform.com') {
url.hostname = 'host.btiplatform.com';
url.port = '__AIRDROP_SERVER_HTTP_PORT2__';
url.port = '__TWITTER_SERVER_HTTP_PORT2__';
} else if (url.hostname === 'ganache.btiplatform.com') {
url.hostname = 'host.btiplatform.com';
url.port = '__GANACHE_HTTP_PORT__';
Expand Down

0 comments on commit 546cbeb

Please sign in to comment.