Compare commits

..

6 Commits

8 changed files with 182 additions and 96 deletions

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/drag-and-drop.js b/browser/components/tabbrowser/content/drag-and-drop.js
index ced2bfd88de2d16e2c028ca3f4d9d27516363575..aaf6e82782357c819ca875f05020723600e41e6b 100644
index ced2bfd88de2d16e2c028ca3f4d9d27516363575..69b45c7dad9d294e4290de4ce878d184925e5610 100644
--- a/browser/components/tabbrowser/content/drag-and-drop.js
+++ b/browser/components/tabbrowser/content/drag-and-drop.js
@@ -35,6 +35,9 @@
@@ -277,7 +277,11 @@ index ced2bfd88de2d16e2c028ca3f4d9d27516363575..aaf6e82782357c819ca875f050207236
tab.removeAttribute("small-stack");
tab.removeAttribute("big-stack");
}
@@ -2582,7 +2585,6 @@
@@ -2578,11 +2581,9 @@
)) {
label.style.width = "";
label.style.maxWidth = "";
- label.style.height = "";
label.style.left = "";
label.style.top = "";
label.style.pointerEvents = "";

View File

@@ -159,8 +159,13 @@ class ZenStartup {
}
#checkForWelcomePage() {
if (!Services.prefs.getBoolPref("zen.welcome-screen.seen", false)) {
Services.prefs.setBoolPref("zen.welcome-screen.seen", true);
const kWelcomeScreenSeenPref = "zen.welcome-screen.seen";
if (Services.env.get("MOZ_HEADLESS")) {
Services.prefs.setBoolPref(kWelcomeScreenSeenPref, true);
return;
}
if (!Services.prefs.getBoolPref(kWelcomeScreenSeenPref, false)) {
Services.prefs.setBoolPref(kWelcomeScreenSeenPref, true);
Services.prefs.setStringPref(
"zen.updates.last-build-id",
Services.appinfo.appBuildID

View File

@@ -13,35 +13,36 @@ export default function checkForZenUpdates() {
const lastVersion = Services.prefs.getStringPref(ZEN_UPDATE_PREF, "");
Services.prefs.setStringPref(ZEN_UPDATE_PREF, version);
if (
version !== lastVersion &&
!gZenUIManager.testingEnabled &&
Services.prefs.getBoolPref(ZEN_UPDATE_SHOW, true)
version === lastVersion ||
gZenUIManager.testingEnabled ||
!Services.prefs.getBoolPref(ZEN_UPDATE_SHOW, true)
) {
const updateUrl = Services.prefs.getStringPref(
"app.releaseNotesURL.prompt",
""
);
createSidebarNotification({
headingL10nId: "zen-sidebar-notification-updated-heading",
links: [
{
url: Services.urlFormatter.formatURL(
updateUrl.replace("%VERSION%", version)
),
l10nId: "zen-sidebar-notification-updated",
special: true,
icon: "chrome://browser/skin/zen-icons/heart-circle-fill.svg",
},
{
action: () => {
Services.obs.notifyObservers(window, "restart-in-safe-mode");
},
l10nId: "zen-sidebar-notification-restart-safe-mode",
icon: "chrome://browser/skin/zen-icons/security-broken.svg",
},
],
});
return;
}
const updateUrl = Services.prefs.getStringPref(
"app.releaseNotesURL.prompt",
""
);
createSidebarNotification({
headingL10nId: "zen-sidebar-notification-updated-heading",
links: [
{
url: Services.urlFormatter.formatURL(
updateUrl.replace("%VERSION%", version)
),
l10nId: "zen-sidebar-notification-updated",
special: true,
icon: "chrome://browser/skin/zen-icons/heart-circle-fill.svg",
},
{
action: () => {
Services.obs.notifyObservers(window, "restart-in-safe-mode");
},
l10nId: "zen-sidebar-notification-restart-safe-mode",
icon: "chrome://browser/skin/zen-icons/security-broken.svg",
},
],
});
}
export async function createWindowUpdateAnimation() {

View File

@@ -10,8 +10,11 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
constructor({ id, state, manager }) {
super({ id, state, manager });
this.state.url = "https://github.com/issues/assigned";
this.state.type = state.type;
this.state.url =
this.state.type === "pull-requests"
? "https://github.com/pulls"
: "https://github.com/issues/assigned";
this.state.options = state.options ?? {};
this.state.repos = new Set(state.repos ?? []);
@@ -29,22 +32,106 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
return "zen-live-folder-github-no-filter";
}
const searchParams = this.#buildSearchOptions();
const url = `${this.state.url}?${searchParams}`;
const queries = this.#buildSearchOptions();
const requests = await Promise.all(
queries.map(query => {
const url = new URL(this.state.url);
url.searchParams.set("q", query);
const { text, status } = await this.fetch(url);
if (this.state.type === "pull-requests") {
return this.parsePullRequests(url.href);
}
// Assume no auth
if (status === 404) {
return "zen-live-folder-github-no-auth";
return this.parseIssues(url.href);
})
);
const combinedItems = new Map();
const combinedActiveRepos = new Set();
for (const { status, items, activeRepos } of requests) {
// Assume no auth
if (status === 404) {
return "zen-live-folder-github-no-auth";
}
if (items) {
items.forEach(item => combinedItems.set(item.id, item));
}
if (activeRepos) {
activeRepos.forEach(repo => combinedActiveRepos.add(repo));
}
}
this.state.repos = combinedActiveRepos;
return Array.from(combinedItems.values());
} catch (error) {
console.error("Error fetching or parsing GitHub issues:", error);
return "zen-live-folder-failed-fetch";
}
}
async parsePullRequests(url) {
const { text, status } = await this.fetch(url);
try {
const document = new DOMParser().parseFromString(text, "text/html");
const issues = document.querySelectorAll("div[id^=issue_]");
const items = [];
const activeRepos = [];
if (issues.length) {
const authors = document.querySelectorAll(".opened-by a");
const titles = document.querySelectorAll("a[id^=issue_]");
for (let i = 0; i < issues.length; i++) {
const author = authors[i].textContent;
const title = titles[i].textContent;
const repo = titles[i].previousElementSibling.textContent.trim();
if (repo) {
activeRepos.push(repo);
}
const idMatch = authors[i].parentElement.textContent
.match(/#[0-9]+/)
.shift();
items.push({
title,
subtitle: author,
icon: "chrome://browser/content/zen-images/favicons/github.svg",
url: new URL(titles[i].href, this.state.url),
id: `${repo}${idMatch}`,
});
}
}
return {
status,
items,
activeRepos,
};
} catch (err) {
console.error("Failed to parse Github pull requests", err);
return {
status,
};
}
}
async parseIssues(url) {
const { text, status } = await this.fetch(url);
try {
const document = new DOMParser().parseFromString(text, "text/html");
const issues = document.querySelectorAll(
"div[class^=IssueItem-module__defaultRepoContainer]"
);
const items = [];
const activeRepos = new Set();
const activeRepos = [];
if (issues.length) {
const authors = document.querySelectorAll(
@@ -65,7 +152,7 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
const repo = rawRepo.textContent?.trim();
if (repo) {
activeRepos.add(repo);
activeRepos.push(repo);
}
const numberMatch = rawNumber?.textContent?.match(/[0-9]+/);
@@ -81,76 +168,67 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
}
}
this.state.repos = activeRepos;
return {
status,
return items;
} catch (error) {
console.error("Error fetching or parsing GitHub issues:", error);
return "zen-live-folder-failed-fetch";
items,
activeRepos,
};
} catch (err) {
console.error("Failed to parse Github Issues", err);
return {
status,
};
}
}
#buildSearchOptions() {
let searchParams = new URLSearchParams();
const baseQuery = [
this.state.type === "pull-requests" ? "is:pr" : "is:issue",
"state:open",
"sort:updated-desc",
];
const options = [
{
value: "state:open",
enabled: true,
value: "author:@me",
enabled: this.state.options.authorMe ?? false,
},
{
value: "sort:updated-desc",
enabled: true,
value: "assignee:@me",
enabled: this.state.options.assignedMe ?? true,
},
{
value: "review-requested:@me",
enabled: this.state.options.reviewRequested ?? false,
},
[
{
value: "is:pr",
enabled: this.state.type === "pull-requests",
},
{
value: "is:issue",
enabled: this.state.type === "issues",
},
],
[
{
value: "author:@me",
enabled: this.state.options.authorMe ?? false,
},
{
value: "assignee:@me",
enabled: this.state.options.assignedMe ?? true,
},
{
value: "review-requested:@me",
enabled: this.state.options.reviewRequested ?? false,
},
],
];
const excluded = this.state.options.repoExcludes;
for (const repo of excluded) {
if (repo && repo.trim()) {
options.push({ value: `-repo:${repo.trim()}`, enabled: true });
baseQuery.push(`-repo:${repo.trim()}`);
}
}
let outputString = "";
const queries = [];
for (const option of options) {
if (Array.isArray(option)) {
const enabledOptions = option.filter(x => x.enabled).map(x => x.value);
if (enabledOptions.length) {
outputString += ` (${enabledOptions.join(" OR ")}) `;
}
continue;
}
if (option.enabled) {
outputString += ` ${option.value} `;
queries.push(option.value);
}
}
searchParams.set("q", outputString.trim().replace(/ +(?= )/g, ""));
return searchParams.toString();
const searchParams = [];
if (this.state.type === "pull-requests") {
for (const query of queries) {
searchParams.push(`${baseQuery.join(" ")} ${query}`);
}
return searchParams;
}
// type: issues
return [`${baseQuery.join(" ")} ${queries.join(" OR ")}`];
}
get options() {
@@ -209,7 +287,7 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
super.onOptionTrigger(option);
const key = option.getAttribute("option-key");
const checked = option.getAttribute("checked") === "true";
const checked = option.hasAttribute("checked");
if (!this.options.some(x => x.key === key)) {
return;
}

View File

@@ -151,10 +151,11 @@ export class nsZenSessionManager {
);
const db = await PlacesUtils.promiseDBConnection();
let data = {};
let rows = await db.execute(
"SELECT * FROM zen_workspaces ORDER BY created_at ASC"
);
let rows = [];
try {
rows = await db.execute(
"SELECT * FROM zen_workspaces ORDER BY created_at ASC"
);
data.spaces = rows.map(row => ({
uuid: row.getResultByName("uuid"),
name: row.getResultByName("name"),

View File

@@ -10,9 +10,6 @@ window.ZenWorkspaceBookmarksStorage = {
ChromeUtils.defineESModuleGetters(this.lazy, {
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
});
if (!window.gZenWorkspaces) {
return;
}
this.promiseInitialized = new Promise(resolve => {
this._resolveInitialized = resolve;
});

View File

@@ -777,7 +777,7 @@ class nsZenWorkspaces {
if (
!this.privateWindowOrDisabled &&
spacesFromStore.length === 0 &&
lazy.ZenSessionStore._migrationData
lazy.ZenSessionStore._migrationData?.spaces
) {
spacesFromStore.push(...lazy.ZenSessionStore._migrationData.spaces);
}

View File

@@ -20,7 +20,7 @@
"brandShortName": "Zen",
"brandFullName": "Zen Browser",
"release": {
"displayVersion": "1.19.4b",
"displayVersion": "1.19.5b",
"github": {
"repo": "zen-browser/desktop"
},