Skip to content

Commit

Permalink
Merge pull request #355 from Mail-0/staging
Browse files Browse the repository at this point in the history
Release 0.2
  • Loading branch information
MrgSub authored Mar 2, 2025
2 parents 21908fc + bee4481 commit 37678fb
Show file tree
Hide file tree
Showing 46 changed files with 2,805 additions and 1,114 deletions.
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: [nizzyabi]

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# dependencies
/node_modules
/apps/*/node_modules
/packages/*/node_modules
/.pnp
.pnp.*
Expand Down Expand Up @@ -45,5 +46,3 @@ next-env.d.ts
.idea
.vscode
.turbo
packages/tailwind-config/node_modules/@zero/tsconfig
packages/db/node_modules/@zero/tsconfig
107 changes: 74 additions & 33 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,66 +1,107 @@
License
0.EMAIL SOFTWARE
Dual Licensing Agreement
Version 2.0, 2025

0.EMAIL SOFTWARE LICENSE
Version 1.0, February 2025
This software is available under two distinct licenses:

Copyright (c) 2025 0.EMAIL
1. GNU Affero General Public License version 3 (AGPL-3.0)
- For open source usage
- Full text available at: https://www.gnu.org/licenses/agpl-3.0.html

2. 0.EMAIL Commercial License
- For commercial usage without AGPL-3.0 obligations
- Contact [email protected] for pricing and terms

PREAMBLE

This license is designed to ensure that users of the 0.EMAIL software retain their freedom to use, modify, and share the software. When we speak of free software, we refer to freedom, not price.
The 0.EMAIL software is committed to maintaining both open source principles
and sustainable business practices. This dual-licensing approach ensures that:
- Open source users retain all freedoms under AGPL-3.0
- Commercial users can obtain flexible licensing terms

TERMS AND CONDITIONS
OPEN SOURCE LICENSE

0. Definitions.
For open source usage under AGPL-3.0, the following notice applies:

"This License" refers to version 1.0 of the 0.email Software License.
"The Program" refers to the 0.EMAIL software and any copyrightable work licensed under this License.
"You" refers to the licensee or user of the software.
0.EMAIL - Enterprise Email Solution
Copyright (C) 2025 0.EMAIL

1. Basic Permissions.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

You are granted permission to use, modify, and distribute the 0.email software, provided you comply with the terms of this License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

2. Source Code Access.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.

If you distribute or make available the 0.email software or modified versions to users interacting with it remotely through a computer network, you must make the corresponding source code available to these users, at no charge, through some standard means of facilitating software copying.
COMMERCIAL LICENSE

3. Modifications.
The 0.EMAIL Commercial License allows you to use 0.EMAIL for commercial purposes
without the restrictions of the AGPL-3.0 license. This includes:

You may modify your copy of the 0.email software and distribute the resulting modified work, provided that:
a) You clearly indicate that you modified the software
b) Any modified version carries prominent notices stating it is released under this License
c) You license the entire modified work as a whole under this License
1. The ability to make modifications to the software without being required to
distribute those modifications under the AGPL-3.0.

2. The ability to integrate the software with your proprietary systems without
triggering AGPL-3.0 requirements for those systems.

3. Priority support and maintenance options.

4. No Warranty.
4. Legal indemnification protections.

THE 0.EMAIL SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
For commercial licensing inquiries, please contact:
Email: [email protected]
Website: https://0.email/commercial-license

5. Limitation of Liability.
LICENSE COMPLIANCE

IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM.
If you are using 0.EMAIL under the AGPL-3.0 license:

6. Accepting License Not Required for Use.
1. Any modifications you make to the software must be made available under
the same AGPL-3.0 license.

2. If you provide network access to functionality of the software (e.g., as a
SaaS offering), you must make the source code available to your users.

3. You must include appropriate copyright notices and license information in
your distribution.

You are not required to accept this License in order to receive or run a copy of the Program. However, nothing else grants you permission to modify or distribute the Program or its derivative works.
If you are using 0.EMAIL under a Commercial License, you must comply with the
terms of that specific license agreement as provided to you.

7. Automatic Licensing of Recipients.
NO WARRANTY DISCLAIMER

Each time you redistribute the Program, the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

END OF TERMS AND CONDITIONS

To apply this license to your 0.email software, include the following notice at the beginning of each source file:
To apply this license to your 0.EMAIL software, include the following notice at the beginning of each source file:

0.EMAIL - Open Source Email
0.EMAIL - Enterprise Email Solution
Copyright (C) 2025 0.EMAIL

This program is dual-licensed under the AGPL-3.0 and the 0.EMAIL Commercial License.

For open source usage:
This program is free software: you can redistribute it and/or modify
it under the terms of the 0.email Software License as published
by 0.EMAIL, version 1.0, or (at your option)
any later version.
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0.EMAIL Software License for more details.
GNU Affero General Public License for more details.

For commercial licensing options, please contact [email protected]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Zero is an open-source email solution that gives users the power to **self-host*

Most email services today are either **closed-source**, **data-hungry**, or **too complex to self-host**. Mail0.io is different:

**Fully Open-Source** – No hidden agendas, no walled gardens. 100% transparency.
**Open-Source** – No hidden agendas, fully transparent.
🔒 **Data Privacy First** – Your emails, your data. No tracking, no selling, no middlemen.
⚙️ **Self-Hosting Freedom** – Run your own email app with ease.
📬 **Unified Inbox** – Connect multiple email providers like Gmail, Outlook, and more.
Expand Down
40 changes: 38 additions & 2 deletions apps/mail/actions/mail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const getMail = async ({ id }: { id: string }) => {
return await driver.get(id);
};

export const markAsRead = async ({ id }: { id: string }) => {
export const markAsRead = async ({ ids }: { ids: string[] }) => {
const headersList = await headers();
const session = await auth.api.getSession({ headers: headersList });

Expand All @@ -109,9 +109,45 @@ export const markAsRead = async ({ id }: { id: string }) => {
});

try {
await driver.markAsRead(id);
await driver.markAsRead(ids);
return { success: true };
} catch (error) {
console.error("Error marking message as read:", error);
return { success: false };
}
};

export const markAsUnread = async ({ ids }: { ids: string[] }) => {
const headersList = await headers();
const session = await auth.api.getSession({ headers: headersList });

if (!session || !session.connectionId) {
throw new Error("Unauthorized, reconnect");
}

const [_connection] = await db
.select()
.from(connection)
.where(and(eq(connection.userId, session.user.id), eq(connection.id, session.connectionId)));

if (!_connection?.accessToken || !_connection.refreshToken) {
throw new Error("Unauthorized, reconnect");
}

const driver = await createDriver(_connection.providerId, {
// Assuming "google" is the provider ID
auth: {
access_token: _connection.accessToken,
refresh_token: _connection.refreshToken,
},
});

try {
await driver.markAsUnread(ids);
return { success: true };
} catch (error) {
console.error("Error marking message as unread:", error);
return { success: false };
}
};

Expand Down
10 changes: 10 additions & 0 deletions apps/mail/app/(routes)/create/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { AppSidebar } from "@/components/ui/app-sidebar";

export default function CreateLayout({ children }: { children: React.ReactNode }) {
return (
<>
<AppSidebar />
<div className="w-full bg-white dark:bg-black md:p-3">{children}</div>
</>
);
}
11 changes: 11 additions & 0 deletions apps/mail/app/(routes)/create/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { CreateEmail } from "@/components/create/create-email";

export default function CreatePage() {
return (
<div className="w-full h-full flex flex-col">
<div className="flex-1 h-full">
<CreateEmail />
</div>
</div>
);
}
2 changes: 2 additions & 0 deletions apps/mail/app/(routes)/mail/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { KeyboardShortcuts } from "@/components/mail/keyboard-shortcuts";
import { AppSidebar } from "@/components/ui/app-sidebar";
import AISidebar from "@/components/ui/ai-sidebar";

export default function MailLayout({ children }: { children: React.ReactNode }) {
return (
<>
<AppSidebar />
<KeyboardShortcuts />
<div className="w-full bg-white md:p-3 dark:bg-black">{children}</div>
<AISidebar />
</>
Expand Down
Loading

0 comments on commit 37678fb

Please sign in to comment.