Skip to content

Update devices.js #24

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

Merged
merged 6 commits into from
May 4, 2025
Merged
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
30 changes: 22 additions & 8 deletions views/devices/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,29 @@ class DevicesView {

async loadGithubReposFromGithub() {
try {
var repo_dict = {};
let total_pages = 10;
let per_page = 50;
// TODO filter for branch
//let url = githubAPIURL + "/search/repositories?q=android_device+owner:omnirom&per_page=100";
//let response = await axios.get(url, {});
//let s = response.data;
//var repo_dict = {};
//for (const [key, value] of Object.entries(s["items"])){
// repo_dict[value["name"]] = 1;
//}
console.log("loadGithubReposFromGithub repo_dict " + Object.keys(repo_dict));
for (let page = 0; page < total_pages; page++) {
let url = githubAPIURL + "/search/repositories?q=android_device+owner:omnirom+pushed:>2022-01-01&per_page="+per_page+"&page="+page;
let response = await axios.get(url, {});
let s = response.data;
if (Object.keys(s["items"]).length == 0) {
break
}
let total_count = s["total_count"];
for (const [key, value] of Object.entries(s["items"])){
repo_dict[value["name"]] = 1;
if (Object.keys(repo_dict).length == total_count) {
break;
}
}
if (Object.keys(repo_dict).length == total_count) {
break;
}
}

this.loadDevice(repo_dict);

} catch (error) {
Expand Down