Skip to content

Commit 73c1f2f

Browse files
Merge pull request #2 from nextcloud/Feat/init
Initial implementation based on email-to-pdf-converter
2 parents 8154af5 + 05c01da commit 73c1f2f

32 files changed

+27844
-0
lines changed

.eslintrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
extends: [
3+
'@nextcloud',
4+
]
5+
}

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: Hamza Mahjoubi <hamzamahjoubi22@proton.me>
2+
# SPDX-License-Identifier: AGPL-3.0-or-later
3+
/js/* binary
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint info.xml
7+
8+
on: pull_request
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: lint-info-xml-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
xml-linters:
19+
runs-on: ubuntu-latest
20+
21+
name: info.xml lint
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
25+
26+
- name: Download schema
27+
run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd
28+
29+
- name: Lint info.xml
30+
uses: ChristophWurst/xmllint-action@36f2a302f84f8c83fceea0b9c59e1eb4a616d3c1 # v1.2
31+
with:
32+
xml-file: ./appinfo/info.xml
33+
xml-schema-file: ./info.xsd

.github/workflows/lint-php-cs.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint php-cs
7+
8+
on: pull_request
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: lint-php-cs-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
lint:
19+
runs-on: ubuntu-latest
20+
21+
name: php-cs
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
26+
27+
- name: Set up php8.2
28+
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2
29+
with:
30+
php-version: 8.2
31+
coverage: none
32+
ini-file: development
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Install dependencies
37+
run: composer i
38+
39+
- name: Lint
40+
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

.github/workflows/lint-php.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint php
7+
8+
on: pull_request
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: lint-php-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
php-lint:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
php-versions: [ '8.0', '8.1', '8.2', '8.3' ]
23+
24+
name: php-lint
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
29+
30+
- name: Set up php ${{ matrix.php-versions }}
31+
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2
32+
with:
33+
php-version: ${{ matrix.php-versions }}
34+
coverage: none
35+
ini-file: development
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Lint
40+
run: composer run lint
41+
42+
summary:
43+
permissions:
44+
contents: none
45+
runs-on: ubuntu-latest
46+
needs: php-lint
47+
48+
if: always()
49+
50+
name: php-lint-summary
51+
52+
steps:
53+
- name: Summary status
54+
run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-FileCopyrightText: Hamza Mahjoubi <hamzamahjoubi22@proton.me>
2+
# SPDX-License-Identifier: AGPL-3.0-or-later
3+
*.iml
4+
.idea
5+
/.php-cs-fixer.cache
6+
/.php_cs.cache
7+
/build/
8+
/js/
9+
/vendor/
10+
node_modules/

.php-cs-fixer.dist.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
// SPDX-FileCopyrightText: Hamza Mahjoubi <hamzamahjoubi22@proton.me>
5+
// SPDX-License-Identifier: AGPL-3.0-or-later
6+
7+
require_once './vendor/autoload.php';
8+
9+
use Nextcloud\CodingStandard\Config;
10+
11+
$config = new Config();
12+
$config
13+
->getFinder()
14+
->ignoreVCSIgnored(true)
15+
->notPath('build')
16+
->notPath('l10n')
17+
->notPath('src')
18+
->notPath('vendor')
19+
->in(__DIR__);
20+
return $config;

LICENSES/AGPL-3.0-or-later.txt

Lines changed: 235 additions & 0 deletions
Large diffs are not rendered by default.

LICENSES/CC0-1.0.txt

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
Creative Commons Legal Code
2+
3+
CC0 1.0 Universal
4+
5+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6+
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7+
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8+
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9+
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10+
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11+
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12+
HEREUNDER.
13+
14+
Statement of Purpose
15+
16+
The laws of most jurisdictions throughout the world automatically confer
17+
exclusive Copyright and Related Rights (defined below) upon the creator
18+
and subsequent owner(s) (each and all, an "owner") of an original work of
19+
authorship and/or a database (each, a "Work").
20+
21+
Certain owners wish to permanently relinquish those rights to a Work for
22+
the purpose of contributing to a commons of creative, cultural and
23+
scientific works ("Commons") that the public can reliably and without fear
24+
of later claims of infringement build upon, modify, incorporate in other
25+
works, reuse and redistribute as freely as possible in any form whatsoever
26+
and for any purposes, including without limitation commercial purposes.
27+
These owners may contribute to the Commons to promote the ideal of a free
28+
culture and the further production of creative, cultural and scientific
29+
works, or to gain reputation or greater distribution for their Work in
30+
part through the use and efforts of others.
31+
32+
For these and/or other purposes and motivations, and without any
33+
expectation of additional consideration or compensation, the person
34+
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35+
is an owner of Copyright and Related Rights in the Work, voluntarily
36+
elects to apply CC0 to the Work and publicly distribute the Work under its
37+
terms, with knowledge of his or her Copyright and Related Rights in the
38+
Work and the meaning and intended legal effect of CC0 on those rights.
39+
40+
1. Copyright and Related Rights. A Work made available under CC0 may be
41+
protected by copyright and related or neighboring rights ("Copyright and
42+
Related Rights"). Copyright and Related Rights include, but are not
43+
limited to, the following:
44+
45+
i. the right to reproduce, adapt, distribute, perform, display,
46+
communicate, and translate a Work;
47+
ii. moral rights retained by the original author(s) and/or performer(s);
48+
iii. publicity and privacy rights pertaining to a person's image or
49+
likeness depicted in a Work;
50+
iv. rights protecting against unfair competition in regards to a Work,
51+
subject to the limitations in paragraph 4(a), below;
52+
v. rights protecting the extraction, dissemination, use and reuse of data
53+
in a Work;
54+
vi. database rights (such as those arising under Directive 96/9/EC of the
55+
European Parliament and of the Council of 11 March 1996 on the legal
56+
protection of databases, and under any national implementation
57+
thereof, including any amended or successor version of such
58+
directive); and
59+
vii. other similar, equivalent or corresponding rights throughout the
60+
world based on applicable law or treaty, and any national
61+
implementations thereof.
62+
63+
2. Waiver. To the greatest extent permitted by, but not in contravention
64+
of, applicable law, Affirmer hereby overtly, fully, permanently,
65+
irrevocably and unconditionally waives, abandons, and surrenders all of
66+
Affirmer's Copyright and Related Rights and associated claims and causes
67+
of action, whether now known or unknown (including existing as well as
68+
future claims and causes of action), in the Work (i) in all territories
69+
worldwide, (ii) for the maximum duration provided by applicable law or
70+
treaty (including future time extensions), (iii) in any current or future
71+
medium and for any number of copies, and (iv) for any purpose whatsoever,
72+
including without limitation commercial, advertising or promotional
73+
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74+
member of the public at large and to the detriment of Affirmer's heirs and
75+
successors, fully intending that such Waiver shall not be subject to
76+
revocation, rescission, cancellation, termination, or any other legal or
77+
equitable action to disrupt the quiet enjoyment of the Work by the public
78+
as contemplated by Affirmer's express Statement of Purpose.
79+
80+
3. Public License Fallback. Should any part of the Waiver for any reason
81+
be judged legally invalid or ineffective under applicable law, then the
82+
Waiver shall be preserved to the maximum extent permitted taking into
83+
account Affirmer's express Statement of Purpose. In addition, to the
84+
extent the Waiver is so judged Affirmer hereby grants to each affected
85+
person a royalty-free, non transferable, non sublicensable, non exclusive,
86+
irrevocable and unconditional license to exercise Affirmer's Copyright and
87+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
88+
maximum duration provided by applicable law or treaty (including future
89+
time extensions), (iii) in any current or future medium and for any number
90+
of copies, and (iv) for any purpose whatsoever, including without
91+
limitation commercial, advertising or promotional purposes (the
92+
"License"). The License shall be deemed effective as of the date CC0 was
93+
applied by Affirmer to the Work. Should any part of the License for any
94+
reason be judged legally invalid or ineffective under applicable law, such
95+
partial invalidity or ineffectiveness shall not invalidate the remainder
96+
of the License, and in such case Affirmer hereby affirms that he or she
97+
will not (i) exercise any of his or her remaining Copyright and Related
98+
Rights in the Work or (ii) assert any associated claims and causes of
99+
action with respect to the Work, in either case contrary to Affirmer's
100+
express Statement of Purpose.
101+
102+
4. Limitations and Disclaimers.
103+
104+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
105+
surrendered, licensed or otherwise affected by this document.
106+
b. Affirmer offers the Work as-is and makes no representations or
107+
warranties of any kind concerning the Work, express, implied,
108+
statutory or otherwise, including without limitation warranties of
109+
title, merchantability, fitness for a particular purpose, non
110+
infringement, or the absence of latent or other defects, accuracy, or
111+
the present or absence of errors, whether or not discoverable, all to
112+
the greatest extent permissible under applicable law.
113+
c. Affirmer disclaims responsibility for clearing rights of other persons
114+
that may apply to the Work or any use thereof, including without
115+
limitation any person's Copyright and Related Rights in the Work.
116+
Further, Affirmer disclaims responsibility for obtaining any necessary
117+
consents, permissions or other rights required for any use of the
118+
Work.
119+
d. Affirmer understands and acknowledges that Creative Commons is not a
120+
party to this document and has no duty or obligation with respect to
121+
this CC0 or use of the Work.

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!--
2+
SPDX-FileCopyrightText: Hamza Mahjoubi <hamzamahjoubi22@proton.me>
3+
SPDX-License-Identifier: CC0-1.0
4+
-->
5+
6+
# Email Viewer
7+
8+
This app integrates the fantastic [Email to PDF Converter from Nick Russler](https://github.com/nickrussler/email-to-pdf-converter) into Nextcloud to view msg and eml files online.
9+
10+
## Server configuration
11+
12+
- Nextcloud 28 (with viewer and files_pdfviewer)
13+
- OpenJDK
14+
- [wkhtmltopdf](https://wkhtmltopdf.org/)
15+
- [Email to PDF Converter](https://github.com/nickrussler/email-to-pdf-converter)
16+
17+
## App setup
18+
19+
- Place the app in your apps folder.
20+
- Store a copy of Email to PDF Converter on the server. Nextcloud must have access to it.
21+
- Enable the app (via `occ app:enable files_emailviewer`).
22+
- Set the path to Email to PDF Converter via `occ config:app:set --value /opt/emailconverter-2.6.0-all.jar files_emailviewer binary_path`.
23+
- Upload a msg or eml file and view it in Nextcloud 🙌
24+
25+
## Outgoing connections
26+
27+
If the message contains images from outside sources, Email to PDF (actually wkhtmltopdf) will download the image, which means external connections are required.
28+
29+
## Building the app
30+
31+
npm ci
32+
npm run build

0 commit comments

Comments
 (0)