forked from charlesbel/Microsoft-Rewards-Farmer
-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.2.0 #208
Draft
cal4
wants to merge
93
commits into
master
Choose a base branch
from
develop
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
1.2.0 #208
Changes from 47 commits
Commits
Show all changes
93 commits
Select commit
Hold shift + click to select a range
05611c7
Update morePromotions.py
OmegaBlurz 4400d48
Update dailySet.py
Rippenkneifer 2b4ea72
Update activities.py
Rippenkneifer cd30d85
Update login.py
Rippenkneifer c793db2
Pulled Pork - Bann & Lock check (#201)
cal4 39bdfea
Pork shoulders (#200)
cal4 568a721
Refactor getRemainingSearches
cal4 cb3c668
Add fixme
cal4 4560eae
Put logging back
cal4 2986396
.gitignore
Guido30 f8f29b3
removed config.yaml
Guido30 102d90b
Merged config-private into config.yaml
Guido30 dcdfdce
Restored configurarion files
Guido30 56c6721
More configs for apprise and more (#203)
cal4 cc7d4c2
Update morePromotions.py
OmegaBlurz 4d8ed73
First Docker implementation
belgio99 ab079fc
Removed duplicate options from cherry-pick
belgio99 245adb1
Added first GitHub Action to push on Docker Hub
belgio99 b2160cd
Added Docker image versioning based on GitHub tags
belgio99 97a4616
Added 15s timeout to support 2FA
belgio99 7893e12
chore: Update Dockerfile to use apt-get instead of apt, and pip --no-…
belgio99 653392f
Delete the apt-get lists after installing packages
belgio99 b08ae39
Removed unused 2FA import
belgio99 c8082ef
Fixed Docker semantic versioning
belgio99 57560e8
Add more promos (#205)
klept0 ab4a8a7
Change action to match username specified in secret
belgio99 fbccd4d
Docker implementation (#114)
cal4 fa5194f
Update morePromotions.py
klept0 ed8c7d6
Add config singletons, combine default configs
cal4 f726e57
Make search simpler and remove failing terms completely
cal4 f8d5ba9
Change log level to info
cal4 8558132
Add assertion message
cal4 04e9e36
Make quicker
cal4 8a9df3d
Fix indent
cal4 1e90f13
Add new promo and fix some
cal4 de76983
Reformat and add PROMOTION_TITLE_TO_SEARCH
cal4 3798ecb
Add comment
cal4 14cc1d7
Add jitter and remove delete
cal4 93375b1
Fix error when switching to new tab and optionally close it
cal4 885f19c
Clarify lang and geo options
cal4 6b3c39a
Reformat
cal4 d3bbaa6
Get language and country from locale
cal4 ee86e6d
Add pycountry and sort alphabetically
cal4 ac792f5
Remove ipapi and upgrade apprise
cal4 f79be71
Refactor getting language and country
cal4 f6a9feb
Refactor warning logging
cal4 49e4930
Put ipapi back
cal4 7f6080a
Handle all activities in single loop
cal4 9a3dc6c
Refactor config
cal4 bdd0c86
Clean up and make consistent
cal4 38f6c12
Simplify message dismiss
cal4 fed3068
Simplify message dismiss
cal4 478557d
Simplify message dismiss
cal4 0e2c966
Use typing_extensions
cal4 f89f2d2
Add option to ignore identity activity
cal4 494c9df
Reformat using Black
cal4 44b0116
Alphabetize
cal4 bc30d82
Clean up activity title for emails
cal4 92d2720
Fix issue where page load timed out
cal4 4572c60
Refactor imports and use method name only
cal4 9291a6e
Remove staticmethod in favor of function https://stackoverflow.com/a/…
cal4 ff3b02d
Remove staticmethod in favor of function https://stackoverflow.com/a/…
cal4 a15f2e5
Add fixme
cal4 c936439
Remove deprecated classes
cal4 6bed6fc
Up timeToWait and use default
cal4 50dc6dc
Fix import order
cal4 8f6ec04
Increase base_delay_in_seconds
cal4 d9d6e7d
Sleep 5-10 minutes after success
cal4 68602ed
Get points from dashboard since more reliable
cal4 ef098d9
Remove scrolls
cal4 245d3b1
Remove comment
cal4 ef42d25
Log incomplete activities
cal4 81afb32
Check for level before getting remaining mobile searches
cal4 6511198
Fix Discover open job roles
cal4 2e2540c
Add new activities
cal4 815001a
Add apprise notification on login with phone code
Kyrela b6ee600
Add login notifications configuration in config.yaml
Kyrela c269afb
Add apprise notification on login with phone code (#229)
cal4 0785ba2
Update userAgentGenerator.py
jdeath 68e4c7f
Update userAgentGenerator.py
jdeath a1352d8
Update userAgentGenerator.py
jdeath 9a21404
Fix Edge API (#233)
cal4 7974152
fix: resolve KeyError in getEdgeVersions and bug in getLanguageCountry
SteveTryndamere 6d23c75
Handle when daily_set_date exists but is empty
cal4 2bf51d3
Add ability to more generically ignore activities
cal4 4ff9d79
fix: resolve KeyError in getEdgeVersions and bug in getLanguageCountr…
cal4 c6d5889
Exit 1 on exception
Kyrela 63c6b32
Better, simpler and unified config
Kyrela a3d2aac
Enhance README.md with command-line override details
Kyrela 8604039
Exit 1 on error (#244)
klept0 770e318
[PROPOSAL] Better, simpler and unified config (#248)
klept0 e88f6ee
Fix unwanted changed on #237
Kyrela 1671870
Fix unwanted changes on #237 (#258)
klept0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,37 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ secrets.DOCKERHUB_USERNAME }}/ms-rewards | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,5 +1,4 @@ | ||
# config-private.yaml | ||
# Copy this file to config-private.yaml to use | ||
apprise: | ||
urls: | ||
- 'discord://WebhookID/WebhookToken' # Replace with your actual Apprise service URLs | ||
# config-private.yaml | ||
apprise: | ||
urls: | ||
- "discord://{WebhookID}/{WebhookToken}" # Replace with your actual Apprise service URLs |
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,9 @@ | ||
FROM python:slim | ||
COPY . /app | ||
WORKDIR /app | ||
RUN apt-get update && apt-get install -y cron chromium chromium-driver \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
ENV DOCKER=1 | ||
CMD ["sh", "docker.sh"] |
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 |
---|---|---|
@@ -1,7 +1,14 @@ | ||
# config.yaml | ||
apprise: | ||
notify: | ||
incomplete-promotions: True # True or False | ||
uncaught-exceptions: True # True or False | ||
summary: ON_ERROR | ||
default: | ||
geolocation: US # Replace with your country code https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 | ||
logging: | ||
level: INFO # See https://docs.python.org/3/library/logging.html#logging-levels | ||
retries: | ||
base_delay_in_seconds: 14.0625 # base_delay_in_seconds * 2^max = 14.0625 * 2^6 = 900 = 15 minutes | ||
max: 8 | ||
max: 4 | ||
strategy: EXPONENTIAL |
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,32 @@ | ||
#!/bin/bash | ||
|
||
# Check if RUN_ONCE environment variable is set. In case, running the script now and exiting. | ||
if [ "$RUN_ONCE" = "true" ] | ||
then | ||
echo "RUN_ONCE environment variable is set. Running the script now and exiting." | ||
python main.py | ||
exit 0 | ||
fi | ||
# Check if CRON_SCHEDULE environment variable is set | ||
if [ -z "$CRON_SCHEDULE" ] | ||
then | ||
echo "CRON_SCHEDULE environment variable is not set. Setting it to 4 AM everyday by default" | ||
CRON_SCHEDULE="0 4 * * *" | ||
fi | ||
|
||
# Setting up cron job | ||
echo "$CRON_SCHEDULE root python /app/main.py >> /var/log/cron.log 2>&1" > /etc/cron.d/rewards-cron-job | ||
|
||
# Give execution rights on the cron job | ||
chmod 0644 /etc/cron.d/rewards-cron-job | ||
|
||
# Apply cron job | ||
crontab /etc/cron.d/rewards-cron-job | ||
|
||
# Create the log file to be able to run tail | ||
touch /var/log/cron.log | ||
|
||
echo "Cron job is set to run at $CRON_SCHEDULE. Waiting for the cron to run..." | ||
|
||
# Run the cron | ||
cron && tail -f /var/log/cron.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
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,15 +1,16 @@ | ||
requests~=2.32.3 | ||
selenium>=4.15.2 # not directly required, pinned by Snyk to avoid a vulnerability | ||
ipapi~=1.0.4 | ||
undetected-chromedriver==3.5.5 | ||
selenium-wire~=5.1.0 | ||
apprise~=1.9.0 | ||
blinker==1.7.0 # prevents issues on newer versions | ||
numpy>=1.22.2 # not directly required, pinned by Snyk to avoid a vulnerability | ||
setuptools | ||
ipapi~=1.0.4 | ||
psutil | ||
blinker==1.7.0 # prevents issues on newer versions | ||
apprise~=1.8.1 | ||
pycountry~=24.6.1 | ||
pyotp~=2.9.0 | ||
pyyaml~=6.0.2 | ||
urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability | ||
requests-oauthlib~=2.0.0 | ||
zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability | ||
pyotp~=2.9.0 | ||
requests~=2.32.3 | ||
selenium-wire~=5.1.0 | ||
selenium>=4.15.2 # not directly required, pinned by Snyk to avoid a vulnerability | ||
setuptools | ||
undetected-chromedriver==3.5.5 | ||
urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability | ||
zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability |
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,8 +1,10 @@ | ||
import contextlib | ||
import logging | ||
import random | ||
import time | ||
|
||
from selenium.common import TimeoutException | ||
from selenium.common.exceptions import NoSuchElementException, ElementNotInteractableException | ||
from selenium.webdriver.common.by import By | ||
from selenium.webdriver.remote.webelement import WebElement | ||
|
||
|
@@ -14,6 +16,29 @@ def __init__(self, browser: Browser): | |
self.browser = browser | ||
self.webdriver = browser.webdriver | ||
|
||
def click_element_if_visible(self, element): | ||
try: | ||
if element.is_displayed() and element.is_enabled(): | ||
element.click() | ||
logging.info("Dashboard pop-up registered and closed, needs to be done once on new accounts") | ||
else: | ||
pass | ||
except (ElementNotInteractableException, NoSuchElementException): | ||
pass | ||
|
||
def dashboardPopUpModalCloseCross(self): | ||
try: | ||
|
||
element = self.webdriver.find_element(By.CSS_SELECTOR, ".dashboardPopUpPopUpSelectButton") | ||
self.click_element_if_visible(element) | ||
time.sleep(0.25) | ||
except NoSuchElementException: | ||
return | ||
|
||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: formatting. run ruff on this :) |
||
|
||
|
||
def openDailySetActivity(self, cardId: int): | ||
# Open the Daily Set activity for the given cardId | ||
element = self.webdriver.find_element(By.XPATH, | ||
|
@@ -26,7 +51,7 @@ def openMorePromotionsActivity(self, cardId: int): | |
element = self.webdriver.find_element(By.CSS_SELECTOR, | ||
f"#more-activities > .m-card-group > .ng-scope:nth-child({cardId + 1}) .ds-card-sec") | ||
self.browser.utils.click(element) | ||
self.browser.utils.switchToNewTab(timeToWait=5) | ||
self.browser.utils.switchToNewTab(timeToWait=8) | ||
|
||
def completeSearch(self): | ||
# Simulate completing a search activity | ||
|
@@ -45,6 +70,7 @@ def completeQuiz(self): | |
with contextlib.suppress(TimeoutException): | ||
startQuiz = self.browser.utils.waitUntilQuizLoads() | ||
self.browser.utils.click(startQuiz) | ||
# this is bugged on Chrome for some reason | ||
cal4 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self.browser.utils.waitUntilVisible( | ||
By.ID, "overlayPanel", 5 | ||
) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this "docker" functionality affect detection at all? I know that running chromium headless can increase chances of being caught by bing, has this been changed?
Btw for alternatives to docker for this usecase, i've already investigate nix, but it does not have the packages required and selenium-wire is broken iirc.