Skip to content

Commit 6adbec9

Browse files
committed
Merge branch 'master' of https://github.com/Borisw123/EasySwitch into dev.borisw.fedapay
2 parents 87a2b2f + 74d1be3 commit 6adbec9

19 files changed

Lines changed: 1801 additions & 30 deletions

File tree

.DS_Store

-8 KB
Binary file not shown.

.github/workflows/deploy-docs.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Deploy MKDocs to GitHub Page
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.12'
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install mkdocs mkdocs-material
27+
28+
- name: Deploy to GitHub Pages
29+
run: mkdocs gh-deploy --force

.github/workflows/lint-format.yml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
# name: Lint & Format
1+
name: Lint & Format
22

3-
# on:
4-
# push:
5-
# branches: [master]
6-
# pull_request:
7-
# branches: [master]
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
88

9-
# jobs:
10-
# lint-format:
11-
# name: Lint, Format, and Type Check
12-
# runs-on: ubuntu-latest
9+
jobs:
10+
lint-format:
11+
name: Lint, Format, and Type Check
12+
runs-on: ubuntu-latest
1313

14-
# steps:
15-
# - name: Checkout code
16-
# uses: actions/checkout@v3
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
1717

18-
# - name: Set up Python
19-
# uses: actions/setup-python@v4
20-
# with:
21-
# python-version: '3.13'
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.13'
2222

23-
# - name: Install dependencies
24-
# run: |
25-
# python -m pip install --upgrade pip
26-
# pip install black isort mypy
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install black isort mypy
2727
28-
# - name: Run black
29-
# run: black .
28+
- name: Run black
29+
run: black .
3030

31-
# - name: Run isort
32-
# run: isort .
31+
- name: Run isort
32+
run: isort .
3333

34-
# - name: Run mypy
35-
# run: mypy .
34+
# - name: Run mypy
35+
# run: mypy .

.gitignore

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,31 @@ examples/*
1212
examples.py
1313
uv.lock
1414
.vscode/*
15-
*.pyc
15+
*.pyc
16+
.DS_Store
17+
*.egg
18+
*.egg-info
19+
*.pyo
20+
*.pyd
21+
*.swp
22+
*.swo
23+
*.log
24+
*.coverage
25+
.coverage.*
26+
.coverage
27+
.coverage.*
28+
*.mo
29+
*.pot
30+
*.po
31+
*.db
32+
*.sqlite3
33+
*.sqlite
34+
*.db-journal
35+
*.pid
36+
*.pid.lock
37+
*.lock
38+
*.bak
39+
*.orig
40+
*.swp
41+
*.swo
42+
site/*

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ We will add progressively support for following Providers:
4545

4646
---
4747

48+
## Community & Support 💬
49+
50+
- [Documentation](https://alldotpy.github.io/EasySwitch/) 📚 (under contructions.)
51+
- [Issue Tracker](https://github.com/AllDotPy/EasySwitch/issues) 🐛
52+
53+
---
54+
4855
## Prerequisites
4956

5057
You need to have at least 3.13 version of python to be able to continue.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
document.addEventListener("DOMContentLoaded", function () {
2+
var script = document.createElement("script");
3+
script.src = "https://widget.kapa.ai/kapa-widget.bundle.js";
4+
script.setAttribute("data-website-id", "95d8dc11-e509-42cb-a7ee-f7e06df52017");
5+
script.setAttribute("data-project-name", "Atlas");
6+
script.setAttribute("data-project-color", "#2894F3");
7+
script.setAttribute("data-project-logo", "https://avatars.githubusercontent.com/u/78708182?s=128");
8+
script.setAttribute("data-modal-disclaimer", "You can find further support on our [Discord server](https://discord.com/servers/atlas-795710270000332800) or [our GitHub Discussions](https://github.com/Atlas-OS/Atlas/discussions). Remember that not all answers are accurate, as results are AI-generated.")
9+
script.setAttribute("data-modal-example-questions", "Does Atlas support Windows Defender?,Who is Atlas for?,What does Atlas do?")
10+
script.setAttribute("data-modal-example-questions-col-span", "12")
11+
script.async = true;
12+
13+
script.onload = () => {
14+
const kapaLoadedCheck = setInterval(() => {
15+
const kapaStyle = document.head.querySelector('style[data-emotion="mantine"]');
16+
if (kapaStyle && kapaStyle.sheet) {
17+
clearInterval(kapaLoadedCheck);
18+
const cssRules = Array.from(kapaStyle.sheet.cssRules).map(rule => rule.cssText).join('\n');
19+
const node = document.body.appendChild(kapaStyle);
20+
node.appendChild(document.createTextNode(cssRules));
21+
}
22+
}, 150);
23+
};
24+
25+
document.head.appendChild(script);
26+
});
27+
28+
function clickKapaAi() {
29+
const button = document.querySelector('#kapa-widget-container > button')
30+
if (button) button.click()
31+
}

docs/assets/javascript/msdl.v1.js

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
// AGPL-3.0-only https://spdx.org/licenses/AGPL-3.0-or-later.html
2+
// Modified from https://github.com/gravesoft/msdl for use in AtlasOS documentation
3+
//
4+
// Changes:
5+
// - Auto-selecting language, and removing 'Choose once'
6+
// - Removing table to download other versions
7+
// - Restructuring of script
8+
// - Simplification of certain functions like updateVars
9+
// - Fixes/adaptations for use in Atlas documentation
10+
11+
const apiUrl = "https://api.gravesoft.dev/msdl/";
12+
13+
let sessionId;
14+
let msContent;
15+
let pleaseWait;
16+
let processingError;
17+
let download;
18+
let downloadLink;
19+
let winProductID;
20+
let skuId;
21+
22+
function uuidv4() {
23+
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>
24+
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4))).toString(16)
25+
);
26+
}
27+
28+
function updateVars() {
29+
// With auto-selection, an option is always selected.
30+
let id = document.getElementById('product-languages').value;
31+
document.getElementById('submit-sku').disabled = false;
32+
skuId = JSON.parse(id)['id'];
33+
console.log(`Updated skuId: ${skuId}`);
34+
return skuId;
35+
}
36+
37+
function showError(error) {
38+
processingError.style.display = "block";
39+
pleaseWait.style.display = "none";
40+
msContent.style.display = "none";
41+
processingError.innerHTML = 'Error: ' + error;
42+
console.error('Error: ' + error);
43+
}
44+
45+
function getFileNameFromLink(link) {
46+
let raw_link = link.split('?')[0];
47+
return raw_link.split('/').pop();
48+
}
49+
50+
function getLanguages(productId) {
51+
let url = `${apiUrl}skuinfo?product_id=${productId}`;
52+
let xhr = new XMLHttpRequest();
53+
xhr.onload = onLanguageXhrChange;
54+
xhr.onerror = function() {
55+
showError("Failed to retrieve languages.");
56+
};
57+
xhr.open("GET", url, true);
58+
xhr.send();
59+
}
60+
61+
function onLanguageXhrChange() {
62+
if (this.status != 200) {
63+
showError("Failed to retrieve languages.");
64+
return;
65+
}
66+
pleaseWait.style.display = "none";
67+
msContent.style.display = "block";
68+
69+
let langHtml = langJsonStrToHTML(this.responseText);
70+
msContent.innerHTML = langHtml;
71+
72+
let prodLang = document.getElementById('product-languages');
73+
prodLang.addEventListener("change", updateVars);
74+
75+
updateVars();
76+
}
77+
78+
function langJsonStrToHTML(jsonStr) {
79+
let json = JSON.parse(jsonStr);
80+
let container = document.createElement('div');
81+
82+
let header = document.createElement('h2');
83+
header.textContent = "Select the product language";
84+
container.appendChild(header);
85+
86+
let info = document.createElement('p');
87+
info.innerHTML = "You'll need to choose the same language when you install Windows. To see what language you're currently using, go to <strong>Time and language</strong> in PC settings or <strong>Region</strong> in Control Panel.";
88+
container.appendChild(info);
89+
90+
let select = document.createElement('select');
91+
select.id = "product-languages";
92+
93+
let defaultOption = document.createElement('option');
94+
defaultOption.value = "";
95+
defaultOption.selected = true;
96+
defaultOption.textContent = "Choose one";
97+
select.appendChild(defaultOption);
98+
99+
json.Skus.forEach(sku => {
100+
let option = document.createElement('option');
101+
option.value = JSON.stringify({ id: sku.Id });
102+
option.textContent = sku.LocalizedLanguage;
103+
select.appendChild(option);
104+
});
105+
106+
container.appendChild(select);
107+
108+
let button = document.createElement('button');
109+
button.id = "submit-sku";
110+
button.textContent = "Download";
111+
button.disabled = true;
112+
button.setAttribute("onClick", "getDownload();");
113+
button.classList = "msdl-button";
114+
container.appendChild(button);
115+
116+
return container.innerHTML;
117+
}
118+
119+
function getDownload() {
120+
msContent.style.display = "none";
121+
pleaseWait.style.display = "block";
122+
skuId = skuId ? skuId : updateVars();
123+
let url = `${apiUrl}proxy?product_id=${winProductID}&sku_id=${skuId}`;
124+
console.log(`Requesting download links from URL: ${url}`);
125+
let xhr = new XMLHttpRequest();
126+
xhr.onload = onDownloadsXhrChange;
127+
xhr.open("GET", url, true);
128+
xhr.send();
129+
}
130+
131+
function onDownloadsXhrChange() {
132+
if (this.status != 200) {
133+
showError("Failed to retrieve download links.");
134+
return;
135+
}
136+
let response = JSON.parse(this.responseText);
137+
console.log('Download response:', response);
138+
139+
pleaseWait.style.display = "none";
140+
msContent.innerHTML = "";
141+
msContent.style.display = "block";
142+
143+
if (response.ProductDownloadOptions && response.ProductDownloadOptions.length > 0) {
144+
let header = document.createElement('h2');
145+
header.textContent = `${response.ProductDownloadOptions[0].ProductDisplayName} ${response.ProductDownloadOptions[0].LocalizedLanguage}`;
146+
msContent.appendChild(header);
147+
148+
response.ProductDownloadOptions.forEach(option => {
149+
let optionContainer = document.createElement('div');
150+
let downloadButton = document.createElement('a');
151+
downloadButton.href = option.Uri;
152+
downloadButton.textContent = getFileNameFromLink(option.Uri);
153+
downloadButton.target = "_blank";
154+
optionContainer.appendChild(downloadButton);
155+
msContent.appendChild(optionContainer);
156+
157+
// Trigger automatic download
158+
const link = document.createElement('a');
159+
link.href = option.Uri;
160+
link.download = getFileNameFromLink(option.Uri);
161+
document.body.appendChild(link);
162+
link.click();
163+
document.body.removeChild(link);
164+
});
165+
} else {
166+
msContent.innerHTML = "<p>No download options available.</p>";
167+
}
168+
}
169+
170+
function getWindows(id) {
171+
// Define variables for contents of page
172+
sessionId = document.getElementById("msdl-session-id");
173+
msContent = document.getElementById("msdl-ms-content");
174+
pleaseWait = document.getElementById("msdl-please-wait");
175+
processingError = document.getElementById("msdl-processing-error");
176+
download = document.getElementById("msdl-download");
177+
downloadLink = document.getElementById("msdl-download-link");
178+
179+
skuId = null;
180+
sessionId.value = uuidv4();
181+
msContent.style.display = "none";
182+
processingError.style.display = "none";
183+
download.style.display = "none";
184+
pleaseWait.style.display = "block";
185+
186+
// Retrieve languages
187+
winProductID = id;
188+
getLanguages(winProductID);
189+
}
2.18 MB
Loading

docs/assets/old_pages/fr/index_.md

Whitespace-only changes.

0 commit comments

Comments
 (0)