├── .github
└── workflows
│ └── php.yml
├── .gitignore
├── LICENSE
├── Makefile
├── README.md
├── appinfo
├── app.php
├── info.xml
└── routes.php
├── composer.json
├── composer.lock
├── js
└── dropbox.js
├── l10n
├── .gitkeep
├── en_GB.js
└── en_GB.json
├── lib
├── AppInfo
│ └── Application.php
├── Backend
│ └── Dropbox.php
├── BackgroundJob
│ └── MetaData.php
├── Controller
│ └── OauthController.php
└── Storage
│ ├── Adapter.php
│ ├── CacheableFlysystemAdapter.php
│ ├── Dropbox.php
│ └── Flysystem.php
├── screenshots
├── LICENCE
├── screenshots-app-external-storage-dropbox.jpg
└── settings.png
└── tests
├── bootstrap.php
├── config.json
├── dropbox.php
└── phpunit.xml
/.github/workflows/php.yml:
--------------------------------------------------------------------------------
1 | name: PHP Composer
2 |
3 | on:
4 | push:
5 | branches: [ "master" ]
6 | pull_request:
7 | branches: [ "master" ]
8 |
9 | permissions:
10 | contents: read
11 |
12 | jobs:
13 | build:
14 |
15 | runs-on: ubuntu-latest
16 |
17 | steps:
18 | - uses: actions/checkout@v4
19 |
20 | - name: Validate composer.json and composer.lock
21 | run: composer validate --no-check-publish
22 |
23 | - name: Cache Composer packages
24 | id: composer-cache
25 | uses: actions/cache@v3
26 | with:
27 | path: vendor
28 | key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
29 | restore-keys: |
30 | ${{ runner.os }}-php-
31 |
32 | - name: Install dependencies
33 | run: composer install --prefer-dist --no-progress
34 |
35 | # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
36 | # Docs: https://getcomposer.org/doc/articles/scripts.md
37 |
38 | # - name: Run test suite
39 | # run: composer run-script test
40 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
3 | .idea
4 |
5 | tests/clover.xml
6 | vendor
7 | build
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU AFFERO GENERAL PUBLIC LICENSE
2 | Version 3, 19 November 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU Affero General Public License is a free, copyleft license for
11 | software and other kinds of works, specifically designed to ensure
12 | cooperation with the community in the case of network server software.
13 |
14 | The licenses for most software and other practical works are designed
15 | to take away your freedom to share and change the works. By contrast,
16 | our General Public Licenses are intended to guarantee your freedom to
17 | share and change all versions of a program--to make sure it remains free
18 | software for all its users.
19 |
20 | When we speak of free software, we are referring to freedom, not
21 | price. Our General Public Licenses are designed to make sure that you
22 | have the freedom to distribute copies of free software (and charge for
23 | them if you wish), that you receive source code or can get it if you
24 | want it, that you can change the software or use pieces of it in new
25 | free programs, and that you know you can do these things.
26 |
27 | Developers that use our General Public Licenses protect your rights
28 | with two steps: (1) assert copyright on the software, and (2) offer
29 | you this License which gives you legal permission to copy, distribute
30 | and/or modify the software.
31 |
32 | A secondary benefit of defending all users' freedom is that
33 | improvements made in alternate versions of the program, if they
34 | receive widespread use, become available for other developers to
35 | incorporate. Many developers of free software are heartened and
36 | encouraged by the resulting cooperation. However, in the case of
37 | software used on network servers, this result may fail to come about.
38 | The GNU General Public License permits making a modified version and
39 | letting the public access it on a server without ever releasing its
40 | source code to the public.
41 |
42 | The GNU Affero General Public License is designed specifically to
43 | ensure that, in such cases, the modified source code becomes available
44 | to the community. It requires the operator of a network server to
45 | provide the source code of the modified version running there to the
46 | users of that server. Therefore, public use of a modified version, on
47 | a publicly accessible server, gives the public access to the source
48 | code of the modified version.
49 |
50 | An older license, called the Affero General Public License and
51 | published by Affero, was designed to accomplish similar goals. This is
52 | a different license, not a version of the Affero GPL, but Affero has
53 | released a new version of the Affero GPL which permits relicensing under
54 | this license.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | TERMS AND CONDITIONS
60 |
61 | 0. Definitions.
62 |
63 | "This License" refers to version 3 of the GNU Affero General Public License.
64 |
65 | "Copyright" also means copyright-like laws that apply to other kinds of
66 | works, such as semiconductor masks.
67 |
68 | "The Program" refers to any copyrightable work licensed under this
69 | License. Each licensee is addressed as "you". "Licensees" and
70 | "recipients" may be individuals or organizations.
71 |
72 | To "modify" a work means to copy from or adapt all or part of the work
73 | in a fashion requiring copyright permission, other than the making of an
74 | exact copy. The resulting work is called a "modified version" of the
75 | earlier work or a work "based on" the earlier work.
76 |
77 | A "covered work" means either the unmodified Program or a work based
78 | on the Program.
79 |
80 | To "propagate" a work means to do anything with it that, without
81 | permission, would make you directly or secondarily liable for
82 | infringement under applicable copyright law, except executing it on a
83 | computer or modifying a private copy. Propagation includes copying,
84 | distribution (with or without modification), making available to the
85 | public, and in some countries other activities as well.
86 |
87 | To "convey" a work means any kind of propagation that enables other
88 | parties to make or receive copies. Mere interaction with a user through
89 | a computer network, with no transfer of a copy, is not conveying.
90 |
91 | An interactive user interface displays "Appropriate Legal Notices"
92 | to the extent that it includes a convenient and prominently visible
93 | feature that (1) displays an appropriate copyright notice, and (2)
94 | tells the user that there is no warranty for the work (except to the
95 | extent that warranties are provided), that licensees may convey the
96 | work under this License, and how to view a copy of this License. If
97 | the interface presents a list of user commands or options, such as a
98 | menu, a prominent item in the list meets this criterion.
99 |
100 | 1. Source Code.
101 |
102 | The "source code" for a work means the preferred form of the work
103 | for making modifications to it. "Object code" means any non-source
104 | form of a work.
105 |
106 | A "Standard Interface" means an interface that either is an official
107 | standard defined by a recognized standards body, or, in the case of
108 | interfaces specified for a particular programming language, one that
109 | is widely used among developers working in that language.
110 |
111 | The "System Libraries" of an executable work include anything, other
112 | than the work as a whole, that (a) is included in the normal form of
113 | packaging a Major Component, but which is not part of that Major
114 | Component, and (b) serves only to enable use of the work with that
115 | Major Component, or to implement a Standard Interface for which an
116 | implementation is available to the public in source code form. A
117 | "Major Component", in this context, means a major essential component
118 | (kernel, window system, and so on) of the specific operating system
119 | (if any) on which the executable work runs, or a compiler used to
120 | produce the work, or an object code interpreter used to run it.
121 |
122 | The "Corresponding Source" for a work in object code form means all
123 | the source code needed to generate, install, and (for an executable
124 | work) run the object code and to modify the work, including scripts to
125 | control those activities. However, it does not include the work's
126 | System Libraries, or general-purpose tools or generally available free
127 | programs which are used unmodified in performing those activities but
128 | which are not part of the work. For example, Corresponding Source
129 | includes interface definition files associated with source files for
130 | the work, and the source code for shared libraries and dynamically
131 | linked subprograms that the work is specifically designed to require,
132 | such as by intimate data communication or control flow between those
133 | subprograms and other parts of the work.
134 |
135 | The Corresponding Source need not include anything that users
136 | can regenerate automatically from other parts of the Corresponding
137 | Source.
138 |
139 | The Corresponding Source for a work in source code form is that
140 | same work.
141 |
142 | 2. Basic Permissions.
143 |
144 | All rights granted under this License are granted for the term of
145 | copyright on the Program, and are irrevocable provided the stated
146 | conditions are met. This License explicitly affirms your unlimited
147 | permission to run the unmodified Program. The output from running a
148 | covered work is covered by this License only if the output, given its
149 | content, constitutes a covered work. This License acknowledges your
150 | rights of fair use or other equivalent, as provided by copyright law.
151 |
152 | You may make, run and propagate covered works that you do not
153 | convey, without conditions so long as your license otherwise remains
154 | in force. You may convey covered works to others for the sole purpose
155 | of having them make modifications exclusively for you, or provide you
156 | with facilities for running those works, provided that you comply with
157 | the terms of this License in conveying all material for which you do
158 | not control copyright. Those thus making or running the covered works
159 | for you must do so exclusively on your behalf, under your direction
160 | and control, on terms that prohibit them from making any copies of
161 | your copyrighted material outside their relationship with you.
162 |
163 | Conveying under any other circumstances is permitted solely under
164 | the conditions stated below. Sublicensing is not allowed; section 10
165 | makes it unnecessary.
166 |
167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168 |
169 | No covered work shall be deemed part of an effective technological
170 | measure under any applicable law fulfilling obligations under article
171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
172 | similar laws prohibiting or restricting circumvention of such
173 | measures.
174 |
175 | When you convey a covered work, you waive any legal power to forbid
176 | circumvention of technological measures to the extent such circumvention
177 | is effected by exercising rights under this License with respect to
178 | the covered work, and you disclaim any intention to limit operation or
179 | modification of the work as a means of enforcing, against the work's
180 | users, your or third parties' legal rights to forbid circumvention of
181 | technological measures.
182 |
183 | 4. Conveying Verbatim Copies.
184 |
185 | You may convey verbatim copies of the Program's source code as you
186 | receive it, in any medium, provided that you conspicuously and
187 | appropriately publish on each copy an appropriate copyright notice;
188 | keep intact all notices stating that this License and any
189 | non-permissive terms added in accord with section 7 apply to the code;
190 | keep intact all notices of the absence of any warranty; and give all
191 | recipients a copy of this License along with the Program.
192 |
193 | You may charge any price or no price for each copy that you convey,
194 | and you may offer support or warranty protection for a fee.
195 |
196 | 5. Conveying Modified Source Versions.
197 |
198 | You may convey a work based on the Program, or the modifications to
199 | produce it from the Program, in the form of source code under the
200 | terms of section 4, provided that you also meet all of these conditions:
201 |
202 | a) The work must carry prominent notices stating that you modified
203 | it, and giving a relevant date.
204 |
205 | b) The work must carry prominent notices stating that it is
206 | released under this License and any conditions added under section
207 | 7. This requirement modifies the requirement in section 4 to
208 | "keep intact all notices".
209 |
210 | c) You must license the entire work, as a whole, under this
211 | License to anyone who comes into possession of a copy. This
212 | License will therefore apply, along with any applicable section 7
213 | additional terms, to the whole of the work, and all its parts,
214 | regardless of how they are packaged. This License gives no
215 | permission to license the work in any other way, but it does not
216 | invalidate such permission if you have separately received it.
217 |
218 | d) If the work has interactive user interfaces, each must display
219 | Appropriate Legal Notices; however, if the Program has interactive
220 | interfaces that do not display Appropriate Legal Notices, your
221 | work need not make them do so.
222 |
223 | A compilation of a covered work with other separate and independent
224 | works, which are not by their nature extensions of the covered work,
225 | and which are not combined with it such as to form a larger program,
226 | in or on a volume of a storage or distribution medium, is called an
227 | "aggregate" if the compilation and its resulting copyright are not
228 | used to limit the access or legal rights of the compilation's users
229 | beyond what the individual works permit. Inclusion of a covered work
230 | in an aggregate does not cause this License to apply to the other
231 | parts of the aggregate.
232 |
233 | 6. Conveying Non-Source Forms.
234 |
235 | You may convey a covered work in object code form under the terms
236 | of sections 4 and 5, provided that you also convey the
237 | machine-readable Corresponding Source under the terms of this License,
238 | in one of these ways:
239 |
240 | a) Convey the object code in, or embodied in, a physical product
241 | (including a physical distribution medium), accompanied by the
242 | Corresponding Source fixed on a durable physical medium
243 | customarily used for software interchange.
244 |
245 | b) Convey the object code in, or embodied in, a physical product
246 | (including a physical distribution medium), accompanied by a
247 | written offer, valid for at least three years and valid for as
248 | long as you offer spare parts or customer support for that product
249 | model, to give anyone who possesses the object code either (1) a
250 | copy of the Corresponding Source for all the software in the
251 | product that is covered by this License, on a durable physical
252 | medium customarily used for software interchange, for a price no
253 | more than your reasonable cost of physically performing this
254 | conveying of source, or (2) access to copy the
255 | Corresponding Source from a network server at no charge.
256 |
257 | c) Convey individual copies of the object code with a copy of the
258 | written offer to provide the Corresponding Source. This
259 | alternative is allowed only occasionally and noncommercially, and
260 | only if you received the object code with such an offer, in accord
261 | with subsection 6b.
262 |
263 | d) Convey the object code by offering access from a designated
264 | place (gratis or for a charge), and offer equivalent access to the
265 | Corresponding Source in the same way through the same place at no
266 | further charge. You need not require recipients to copy the
267 | Corresponding Source along with the object code. If the place to
268 | copy the object code is a network server, the Corresponding Source
269 | may be on a different server (operated by you or a third party)
270 | that supports equivalent copying facilities, provided you maintain
271 | clear directions next to the object code saying where to find the
272 | Corresponding Source. Regardless of what server hosts the
273 | Corresponding Source, you remain obligated to ensure that it is
274 | available for as long as needed to satisfy these requirements.
275 |
276 | e) Convey the object code using peer-to-peer transmission, provided
277 | you inform other peers where the object code and Corresponding
278 | Source of the work are being offered to the general public at no
279 | charge under subsection 6d.
280 |
281 | A separable portion of the object code, whose source code is excluded
282 | from the Corresponding Source as a System Library, need not be
283 | included in conveying the object code work.
284 |
285 | A "User Product" is either (1) a "consumer product", which means any
286 | tangible personal property which is normally used for personal, family,
287 | or household purposes, or (2) anything designed or sold for incorporation
288 | into a dwelling. In determining whether a product is a consumer product,
289 | doubtful cases shall be resolved in favor of coverage. For a particular
290 | product received by a particular user, "normally used" refers to a
291 | typical or common use of that class of product, regardless of the status
292 | of the particular user or of the way in which the particular user
293 | actually uses, or expects or is expected to use, the product. A product
294 | is a consumer product regardless of whether the product has substantial
295 | commercial, industrial or non-consumer uses, unless such uses represent
296 | the only significant mode of use of the product.
297 |
298 | "Installation Information" for a User Product means any methods,
299 | procedures, authorization keys, or other information required to install
300 | and execute modified versions of a covered work in that User Product from
301 | a modified version of its Corresponding Source. The information must
302 | suffice to ensure that the continued functioning of the modified object
303 | code is in no case prevented or interfered with solely because
304 | modification has been made.
305 |
306 | If you convey an object code work under this section in, or with, or
307 | specifically for use in, a User Product, and the conveying occurs as
308 | part of a transaction in which the right of possession and use of the
309 | User Product is transferred to the recipient in perpetuity or for a
310 | fixed term (regardless of how the transaction is characterized), the
311 | Corresponding Source conveyed under this section must be accompanied
312 | by the Installation Information. But this requirement does not apply
313 | if neither you nor any third party retains the ability to install
314 | modified object code on the User Product (for example, the work has
315 | been installed in ROM).
316 |
317 | The requirement to provide Installation Information does not include a
318 | requirement to continue to provide support service, warranty, or updates
319 | for a work that has been modified or installed by the recipient, or for
320 | the User Product in which it has been modified or installed. Access to a
321 | network may be denied when the modification itself materially and
322 | adversely affects the operation of the network or violates the rules and
323 | protocols for communication across the network.
324 |
325 | Corresponding Source conveyed, and Installation Information provided,
326 | in accord with this section must be in a format that is publicly
327 | documented (and with an implementation available to the public in
328 | source code form), and must require no special password or key for
329 | unpacking, reading or copying.
330 |
331 | 7. Additional Terms.
332 |
333 | "Additional permissions" are terms that supplement the terms of this
334 | License by making exceptions from one or more of its conditions.
335 | Additional permissions that are applicable to the entire Program shall
336 | be treated as though they were included in this License, to the extent
337 | that they are valid under applicable law. If additional permissions
338 | apply only to part of the Program, that part may be used separately
339 | under those permissions, but the entire Program remains governed by
340 | this License without regard to the additional permissions.
341 |
342 | When you convey a copy of a covered work, you may at your option
343 | remove any additional permissions from that copy, or from any part of
344 | it. (Additional permissions may be written to require their own
345 | removal in certain cases when you modify the work.) You may place
346 | additional permissions on material, added by you to a covered work,
347 | for which you have or can give appropriate copyright permission.
348 |
349 | Notwithstanding any other provision of this License, for material you
350 | add to a covered work, you may (if authorized by the copyright holders of
351 | that material) supplement the terms of this License with terms:
352 |
353 | a) Disclaiming warranty or limiting liability differently from the
354 | terms of sections 15 and 16 of this License; or
355 |
356 | b) Requiring preservation of specified reasonable legal notices or
357 | author attributions in that material or in the Appropriate Legal
358 | Notices displayed by works containing it; or
359 |
360 | c) Prohibiting misrepresentation of the origin of that material, or
361 | requiring that modified versions of such material be marked in
362 | reasonable ways as different from the original version; or
363 |
364 | d) Limiting the use for publicity purposes of names of licensors or
365 | authors of the material; or
366 |
367 | e) Declining to grant rights under trademark law for use of some
368 | trade names, trademarks, or service marks; or
369 |
370 | f) Requiring indemnification of licensors and authors of that
371 | material by anyone who conveys the material (or modified versions of
372 | it) with contractual assumptions of liability to the recipient, for
373 | any liability that these contractual assumptions directly impose on
374 | those licensors and authors.
375 |
376 | All other non-permissive additional terms are considered "further
377 | restrictions" within the meaning of section 10. If the Program as you
378 | received it, or any part of it, contains a notice stating that it is
379 | governed by this License along with a term that is a further
380 | restriction, you may remove that term. If a license document contains
381 | a further restriction but permits relicensing or conveying under this
382 | License, you may add to a covered work material governed by the terms
383 | of that license document, provided that the further restriction does
384 | not survive such relicensing or conveying.
385 |
386 | If you add terms to a covered work in accord with this section, you
387 | must place, in the relevant source files, a statement of the
388 | additional terms that apply to those files, or a notice indicating
389 | where to find the applicable terms.
390 |
391 | Additional terms, permissive or non-permissive, may be stated in the
392 | form of a separately written license, or stated as exceptions;
393 | the above requirements apply either way.
394 |
395 | 8. Termination.
396 |
397 | You may not propagate or modify a covered work except as expressly
398 | provided under this License. Any attempt otherwise to propagate or
399 | modify it is void, and will automatically terminate your rights under
400 | this License (including any patent licenses granted under the third
401 | paragraph of section 11).
402 |
403 | However, if you cease all violation of this License, then your
404 | license from a particular copyright holder is reinstated (a)
405 | provisionally, unless and until the copyright holder explicitly and
406 | finally terminates your license, and (b) permanently, if the copyright
407 | holder fails to notify you of the violation by some reasonable means
408 | prior to 60 days after the cessation.
409 |
410 | Moreover, your license from a particular copyright holder is
411 | reinstated permanently if the copyright holder notifies you of the
412 | violation by some reasonable means, this is the first time you have
413 | received notice of violation of this License (for any work) from that
414 | copyright holder, and you cure the violation prior to 30 days after
415 | your receipt of the notice.
416 |
417 | Termination of your rights under this section does not terminate the
418 | licenses of parties who have received copies or rights from you under
419 | this License. If your rights have been terminated and not permanently
420 | reinstated, you do not qualify to receive new licenses for the same
421 | material under section 10.
422 |
423 | 9. Acceptance Not Required for Having Copies.
424 |
425 | You are not required to accept this License in order to receive or
426 | run a copy of the Program. Ancillary propagation of a covered work
427 | occurring solely as a consequence of using peer-to-peer transmission
428 | to receive a copy likewise does not require acceptance. However,
429 | nothing other than this License grants you permission to propagate or
430 | modify any covered work. These actions infringe copyright if you do
431 | not accept this License. Therefore, by modifying or propagating a
432 | covered work, you indicate your acceptance of this License to do so.
433 |
434 | 10. Automatic Licensing of Downstream Recipients.
435 |
436 | Each time you convey a covered work, the recipient automatically
437 | receives a license from the original licensors, to run, modify and
438 | propagate that work, subject to this License. You are not responsible
439 | for enforcing compliance by third parties with this License.
440 |
441 | An "entity transaction" is a transaction transferring control of an
442 | organization, or substantially all assets of one, or subdividing an
443 | organization, or merging organizations. If propagation of a covered
444 | work results from an entity transaction, each party to that
445 | transaction who receives a copy of the work also receives whatever
446 | licenses to the work the party's predecessor in interest had or could
447 | give under the previous paragraph, plus a right to possession of the
448 | Corresponding Source of the work from the predecessor in interest, if
449 | the predecessor has it or can get it with reasonable efforts.
450 |
451 | You may not impose any further restrictions on the exercise of the
452 | rights granted or affirmed under this License. For example, you may
453 | not impose a license fee, royalty, or other charge for exercise of
454 | rights granted under this License, and you may not initiate litigation
455 | (including a cross-claim or counterclaim in a lawsuit) alleging that
456 | any patent claim is infringed by making, using, selling, offering for
457 | sale, or importing the Program or any portion of it.
458 |
459 | 11. Patents.
460 |
461 | A "contributor" is a copyright holder who authorizes use under this
462 | License of the Program or a work on which the Program is based. The
463 | work thus licensed is called the contributor's "contributor version".
464 |
465 | A contributor's "essential patent claims" are all patent claims
466 | owned or controlled by the contributor, whether already acquired or
467 | hereafter acquired, that would be infringed by some manner, permitted
468 | by this License, of making, using, or selling its contributor version,
469 | but do not include claims that would be infringed only as a
470 | consequence of further modification of the contributor version. For
471 | purposes of this definition, "control" includes the right to grant
472 | patent sublicenses in a manner consistent with the requirements of
473 | this License.
474 |
475 | Each contributor grants you a non-exclusive, worldwide, royalty-free
476 | patent license under the contributor's essential patent claims, to
477 | make, use, sell, offer for sale, import and otherwise run, modify and
478 | propagate the contents of its contributor version.
479 |
480 | In the following three paragraphs, a "patent license" is any express
481 | agreement or commitment, however denominated, not to enforce a patent
482 | (such as an express permission to practice a patent or covenant not to
483 | sue for patent infringement). To "grant" such a patent license to a
484 | party means to make such an agreement or commitment not to enforce a
485 | patent against the party.
486 |
487 | If you convey a covered work, knowingly relying on a patent license,
488 | and the Corresponding Source of the work is not available for anyone
489 | to copy, free of charge and under the terms of this License, through a
490 | publicly available network server or other readily accessible means,
491 | then you must either (1) cause the Corresponding Source to be so
492 | available, or (2) arrange to deprive yourself of the benefit of the
493 | patent license for this particular work, or (3) arrange, in a manner
494 | consistent with the requirements of this License, to extend the patent
495 | license to downstream recipients. "Knowingly relying" means you have
496 | actual knowledge that, but for the patent license, your conveying the
497 | covered work in a country, or your recipient's use of the covered work
498 | in a country, would infringe one or more identifiable patents in that
499 | country that you have reason to believe are valid.
500 |
501 | If, pursuant to or in connection with a single transaction or
502 | arrangement, you convey, or propagate by procuring conveyance of, a
503 | covered work, and grant a patent license to some of the parties
504 | receiving the covered work authorizing them to use, propagate, modify
505 | or convey a specific copy of the covered work, then the patent license
506 | you grant is automatically extended to all recipients of the covered
507 | work and works based on it.
508 |
509 | A patent license is "discriminatory" if it does not include within
510 | the scope of its coverage, prohibits the exercise of, or is
511 | conditioned on the non-exercise of one or more of the rights that are
512 | specifically granted under this License. You may not convey a covered
513 | work if you are a party to an arrangement with a third party that is
514 | in the business of distributing software, under which you make payment
515 | to the third party based on the extent of your activity of conveying
516 | the work, and under which the third party grants, to any of the
517 | parties who would receive the covered work from you, a discriminatory
518 | patent license (a) in connection with copies of the covered work
519 | conveyed by you (or copies made from those copies), or (b) primarily
520 | for and in connection with specific products or compilations that
521 | contain the covered work, unless you entered into that arrangement,
522 | or that patent license was granted, prior to 28 March 2007.
523 |
524 | Nothing in this License shall be construed as excluding or limiting
525 | any implied license or other defenses to infringement that may
526 | otherwise be available to you under applicable patent law.
527 |
528 | 12. No Surrender of Others' Freedom.
529 |
530 | If conditions are imposed on you (whether by court order, agreement or
531 | otherwise) that contradict the conditions of this License, they do not
532 | excuse you from the conditions of this License. If you cannot convey a
533 | covered work so as to satisfy simultaneously your obligations under this
534 | License and any other pertinent obligations, then as a consequence you may
535 | not convey it at all. For example, if you agree to terms that obligate you
536 | to collect a royalty for further conveying from those to whom you convey
537 | the Program, the only way you could satisfy both those terms and this
538 | License would be to refrain entirely from conveying the Program.
539 |
540 | 13. Remote Network Interaction; Use with the GNU General Public License.
541 |
542 | Notwithstanding any other provision of this License, if you modify the
543 | Program, your modified version must prominently offer all users
544 | interacting with it remotely through a computer network (if your version
545 | supports such interaction) an opportunity to receive the Corresponding
546 | Source of your version by providing access to the Corresponding Source
547 | from a network server at no charge, through some standard or customary
548 | means of facilitating copying of software. This Corresponding Source
549 | shall include the Corresponding Source for any work covered by version 3
550 | of the GNU General Public License that is incorporated pursuant to the
551 | following paragraph.
552 |
553 | Notwithstanding any other provision of this License, you have
554 | permission to link or combine any covered work with a work licensed
555 | under version 3 of the GNU General Public License into a single
556 | combined work, and to convey the resulting work. The terms of this
557 | License will continue to apply to the part which is the covered work,
558 | but the work with which it is combined will remain governed by version
559 | 3 of the GNU General Public License.
560 |
561 | 14. Revised Versions of this License.
562 |
563 | The Free Software Foundation may publish revised and/or new versions of
564 | the GNU Affero General Public License from time to time. Such new versions
565 | will be similar in spirit to the present version, but may differ in detail to
566 | address new problems or concerns.
567 |
568 | Each version is given a distinguishing version number. If the
569 | Program specifies that a certain numbered version of the GNU Affero General
570 | Public License "or any later version" applies to it, you have the
571 | option of following the terms and conditions either of that numbered
572 | version or of any later version published by the Free Software
573 | Foundation. If the Program does not specify a version number of the
574 | GNU Affero General Public License, you may choose any version ever published
575 | by the Free Software Foundation.
576 |
577 | If the Program specifies that a proxy can decide which future
578 | versions of the GNU Affero General Public License can be used, that proxy's
579 | public statement of acceptance of a version permanently authorizes you
580 | to choose that version for the Program.
581 |
582 | Later license versions may give you additional or different
583 | permissions. However, no additional obligations are imposed on any
584 | author or copyright holder as a result of your choosing to follow a
585 | later version.
586 |
587 | 15. Disclaimer of Warranty.
588 |
589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
597 |
598 | 16. Limitation of Liability.
599 |
600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
608 | SUCH DAMAGES.
609 |
610 | 17. Interpretation of Sections 15 and 16.
611 |
612 | If the disclaimer of warranty and limitation of liability provided
613 | above cannot be given local legal effect according to their terms,
614 | reviewing courts shall apply local law that most closely approximates
615 | an absolute waiver of all civil liability in connection with the
616 | Program, unless a warranty or assumption of liability accompanies a
617 | copy of the Program in return for a fee.
618 |
619 | END OF TERMS AND CONDITIONS
620 |
621 | How to Apply These Terms to Your New Programs
622 |
623 | If you develop a new program, and you want it to be of the greatest
624 | possible use to the public, the best way to achieve this is to make it
625 | free software which everyone can redistribute and change under these terms.
626 |
627 | To do so, attach the following notices to the program. It is safest
628 | to attach them to the start of each source file to most effectively
629 | state the exclusion of warranty; and each file should have at least
630 | the "copyright" line and a pointer to where the full notice is found.
631 |
632 |
633 | Copyright (C)
634 |
635 | This program is free software: you can redistribute it and/or modify
636 | it under the terms of the GNU Affero General Public License as published
637 | by the Free Software Foundation, either version 3 of the License, or
638 | (at your option) any later version.
639 |
640 | This program is distributed in the hope that it will be useful,
641 | but WITHOUT ANY WARRANTY; without even the implied warranty of
642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643 | GNU Affero General Public License for more details.
644 |
645 | You should have received a copy of the GNU Affero General Public License
646 | along with this program. If not, see .
647 |
648 | Also add information on how to contact you by electronic and paper mail.
649 |
650 | If your software can interact with users remotely through a computer
651 | network, you should also make sure that it provides a way for users to
652 | get its source. For example, if your program is a web application, its
653 | interface could display a "Source" link that leads users to an archive
654 | of the code. There are many ways you could offer source, and different
655 | solutions will be better for different programs; see section 13 for the
656 | specific requirements.
657 |
658 | You should also get your employer (if you work as a programmer) or school,
659 | if any, to sign a "copyright disclaimer" for the program, if necessary.
660 | For more information on this, and how to apply and follow the GNU AGPL, see
661 | .
662 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | SHELL := /bin/bash
2 |
3 | #
4 | # Define NPM and check if it is available on the system.
5 | #
6 |
7 | app_name=$(notdir $(CURDIR))
8 | project_directory=$(CURDIR)/../$(app_name)
9 | build_tools_directory=$(CURDIR)/build/tools
10 | appstore_package_name=$(CURDIR)/build/dist/$(app_name)
11 | composer=$(shell which composer 2> /dev/null)
12 |
13 | occ=$(CURDIR)/../../occ
14 | private_key=$(HOME)/.nextcloud/certificates/$(app_name).key
15 | certificate=$(HOME)/.nextcloud/certificates/$(app_name).crt
16 | sign=php -f $(occ) integrity:sign-app --privateKey="$(private_key)" --certificate="$(certificate)"
17 | sign_skip_msg="Skipping signing, either no key and certificate found in $(private_key) and $(certificate) or occ can not be found at $(occ)"
18 | ifneq (,$(wildcard $(private_key)))
19 | ifneq (,$(wildcard $(certificate)))
20 | ifneq (,$(wildcard $(occ)))
21 | CAN_SIGN=true
22 | endif
23 | endif
24 | endif
25 |
26 | PHPUNIT="$(PWD)/lib/composer/phpunit/phpunit/phpunit"
27 |
28 | market_doc_files=LICENSE README.md
29 | market_src_dirs=appinfo l10n js lib vendor
30 | market_all_src=$(market_src_dirs) $(market_doc_files)
31 | build_dir=build
32 | dist_dir=$(build_dir)/dist
33 | COMPOSER_BIN=$(build_dir)/composer.phar
34 |
35 | # internal aliases
36 | composer_deps=vendor/
37 | composer_dev_deps=lib/composer/phpunit
38 |
39 | #
40 | # Catch-all rules
41 | #
42 | .PHONY: all
43 | all: $(composer_dev_deps)
44 |
45 | .PHONY: clean
46 | clean: clean-composer-deps clean-dist clean-build
47 |
48 | #
49 | # Basic required tools
50 | #
51 | $(COMPOSER_BIN):
52 | mkdir $(build_dir)
53 | cd $(build_dir) && curl -sS https://getcomposer.org/installer | php
54 |
55 | #
56 | # ownCloud market PHP dependencies
57 | #
58 | $(composer_deps): $(COMPOSER_BIN) composer.json composer.lock
59 | php $(COMPOSER_BIN) install --no-dev
60 |
61 | $(composer_dev_deps): $(COMPOSER_BIN) composer.json composer.lock
62 | php $(COMPOSER_BIN) install --dev
63 |
64 | .PHONY: clean-composer-deps
65 | clean-composer-deps:
66 | rm -f $(COMPOSER_BIN)
67 | rm -Rf $(composer_deps)
68 |
69 | .PHONY: update-composer
70 | update-composer: $(COMPOSER_BIN)
71 | rm -f composer.lock
72 | php $(COMPOSER_BIN) install --prefer-dist
73 |
74 | #
75 | # dist
76 | #
77 |
78 | $(dist_dir)/files_external_dropbox: $(composer_deps)
79 | rm -Rf $@; mkdir -p $@
80 | cp -R $(market_all_src) $@
81 | find $@/vendor -type d -iname Test? -print | xargs rm -Rf
82 | find $@/vendor -type d -iname \.git -print | xargs rm -Rf
83 | find $@/vendor -name travis -print | xargs rm -Rf
84 | find $@/vendor -name doc -print | xargs rm -Rf
85 | find $@/vendor -iname \*.sh -delete
86 | find $@/vendor -iname \*.exe -delete
87 |
88 | .PHONY: dist
89 | dist: clean $(dist_dir)/files_external_dropbox
90 | ifdef CAN_SIGN
91 | $(sign) --path="$(appstore_package_name)"
92 | else
93 | @echo $(sign_skip_msg)
94 | endif
95 | tar -czf $(appstore_package_name).tar.gz -C $(appstore_package_name)/../ $(app_name)
96 |
97 | .PHONY: clean-dist
98 | clean-dist:
99 | rm -Rf $(dist_dir)
100 |
101 | .PHONY: clean-build
102 | clean-build:
103 | rm -Rf $(build_dir)
104 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # files_external_dropbox
2 | Flysystem based dropbox backend for Nextcloud
3 |
4 | Requires Nextcloud 22.0 to 25.0
5 |
6 | ## Steps For Installation
7 | ### From App Store
8 | - Install the app from [App Store](https://apps.nextcloud.com/apps/files_external_dropbox)
9 | - Enable the app in the web interface
10 | ### From Source
11 | - Clone the [source](https://github.com/DJaeger/files_external_dropbox.git) into the Nextcloud apps directory.
12 | - Set the directory ownership according to your setup.
13 | - Run `make` or `composer install` within the apps directory
14 | - Enable the app by running `occ app:enable files_external_dropbox` from nextcloud main directory
15 | ### Configuring OAuth2
16 | - Connecting Dropbox is a little more work because you have to create a Dropbox app.
17 | - Log into [Dropbox Developers](http://www.dropbox.com/developers) page and click Create Your App
18 | - Then choose which folders to share, or to share everything in your Dropbox.
19 | - Name Your App and then click Create App
20 | - Under the section **OAuth2** Redirect URIs add a new URL
21 | - For adding global storages:
22 | ```https://mynextcloud.example.com/index.php/settings/admin/externalstorages```
23 | - For user storages:
24 | ```https://mynextcloud.example.com/index.php/settings/user/externalstorages```
25 |
26 | _Replace `https://mynextcloud.example.com/` with your valid Nextcloud installation path._
27 | _If you have set `htaccess.RewriteBase` in your `config.php` you may need to remove `/index.php` and may need to add a subdirectory_
28 | - Then go to nextcloud ```/settings/admin/externalstorages``` and add a new storage **Dropbox V2**
29 | > :warning: **Warning:** There is a bug introduced in Nextcloud v24.0.0 but only fixed in v27.0.0 and up.
30 | >
31 | > This bug prevents any interactive authorisation for external storages like its required for OAuth2,
32 | > but any existing authorization remains in place as long as it is not revoked.
33 | > If you know what you are doing, you may fix it yourself, like it has been done in core version 27.0.0:
34 | > https://github.com/nextcloud/server/commit/da83464459d4fc2fd4965b805354933f8e6fbdf6
35 | > You need to reapply this patch after any update of the files_external app and the Nextcloud core until core version 27.0.0.
36 | - Fill the details Client Id, Client Secrets from your Dropbox App page (search for "App key" and "App secret")
37 | - Click Grant Access and then you will be redirected to the OAuth login
38 | - After completing the OAuth you will be redirect back to Storage Section and you should see **green** mark along your storage configuration
39 | ### Global configuration
40 | - To allow any user to configure his own dropbox storage, you need to ensure that relevant checkbox is setting under "Allow users to mount external storage"
41 |
42 | ## Dependencies
43 | This app depends on the flysystem adapter for dropbox which can be found here:
44 | [https://github.com/Hemant-Mann/flysystem-dropbox](https://github.com/Hemant-Mann/flysystem-dropbox)
45 |
--------------------------------------------------------------------------------
/appinfo/app.php:
--------------------------------------------------------------------------------
1 |
4 | *
5 | * @copyright Copyright (c) 2017, ownCloud GmbH.
6 | * @license AGPL-3.0
7 | *
8 | * This code is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Affero General Public License, version 3,
10 | * as published by the Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Affero General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Affero General Public License, version 3,
18 | * along with this program. If not, see
19 | *
20 | */
21 |
22 | if ((@include_once(dirname(__DIR__).'/vendor/autoload.php')) === false) {
23 | throw new \Exception('Cannot include autoload. Did you install dependencies using composer?');
24 | }
25 |
26 | if (!\OC_App::isEnabled('files_external')) {
27 | \OC_App::enable('files_external');
28 | }
29 |
30 | $app = new \OCA\Files_external_dropbox\AppInfo\Application();
31 | $app->register();
32 |
--------------------------------------------------------------------------------
/appinfo/info.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | files_external_dropbox
5 | External Storage backend for Dropbox
6 | Integrate Dropbox as an external storage
7 | :warning: **Warning:** There is a bug introduced in Nextcloud v24.0.0 but only fixed in v27.0.0 and up.
33 | >
34 | > This bug prevents any interactive authorisation for external storages like its required for OAuth2,
35 |
36 | > but any existing authorization remains in place as long as it is not revoked.
37 |
38 | > If you know what you are doing, you may fix it yourself, like it has been done in core version 27.0.0:
39 |
40 | > https://github.com/nextcloud/server/commit/da83464459d4fc2fd4965b805354933f8e6fbdf6
41 |
42 | > You need to reapply this patch after any update of the files_external app and the Nextcloud core until core version 27.0.0.
43 | - Fill the details Client Id, Client Secrets from your Dropbox App page (search for "App key" and "App secret")
44 | - Click Grant Access and then you will be redirected to the OAuth login
45 | - After completing the OAuth you will be redirect back to Storage Section and you should see **green** mark along your storage configuration
46 | - That's it
47 | ]]>
48 | 1.5.2
49 | agpl
50 | Daniel Jäger
51 | Robin Appelman
52 | Hemant Mann
53 |
54 | Files_external_dropbox
55 |
56 |
57 |
58 | files
59 | tools
60 |
61 | https://github.com/DJaeger/files_external_dropbox/
62 | https://github.com/DJaeger/files_external_dropbox/issues
63 | https://github.com/DJaeger/files_external_dropbox.git
64 |
65 | https://raw.githubusercontent.com/DJaeger/files_external_dropbox/master/screenshots/screenshots-app-external-storage-dropbox.jpg
66 |
67 |
68 | https://raw.githubusercontent.com/DJaeger/files_external_dropbox/master/screenshots/settings.png
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | OCA\Files_external_dropbox\BackgroundJob\MetaData
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/appinfo/routes.php:
--------------------------------------------------------------------------------
1 |
4 | *
5 | * @copyright Copyright (c) 2017, ownCloud GmbH.
6 | * @license AGPL-3.0
7 | *
8 | * This code is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Affero General Public License, version 3,
10 | * as published by the Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Affero General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Affero General Public License, version 3,
18 | * along with this program. If not, see
19 | *
20 | */
21 |
22 | $app = new \OCA\Files_external_dropbox\AppInfo\Application();
23 |
24 | $app->registerRoutes($this, [
25 | 'routes' => [
26 | ['name' => 'oauth#receiveToken', 'url' => '/oauth', 'verb' => 'POST'],
27 | ],
28 | ]);
29 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "repositories": [
3 | {
4 | "type": "vcs",
5 | "url": "https://github.com/Hemant-Mann/flysystem-dropbox"
6 | }
7 | ],
8 | "require": {
9 | "kunalvarma05/dropbox-php-sdk": "v0.4.2",
10 | "hemant-mann/flysystem-dropbox": "v1.0.5"
11 | },
12 | "minimum-stability": "dev"
13 | }
14 |
--------------------------------------------------------------------------------
/composer.lock:
--------------------------------------------------------------------------------
1 | {
2 | "_readme": [
3 | "This file locks the dependencies of your project to a known state",
4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 | "This file is @generated automatically"
6 | ],
7 | "content-hash": "1494888a5c96699a70220e301526603a",
8 | "packages": [
9 | {
10 | "name": "guzzlehttp/guzzle",
11 | "version": "7.9.x-dev",
12 | "source": {
13 | "type": "git",
14 | "url": "https://github.com/guzzle/guzzle.git",
15 | "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77"
16 | },
17 | "dist": {
18 | "type": "zip",
19 | "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",
20 | "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",
21 | "shasum": ""
22 | },
23 | "require": {
24 | "ext-json": "*",
25 | "guzzlehttp/promises": "^1.5.3 || ^2.0.3",
26 | "guzzlehttp/psr7": "^2.7.0",
27 | "php": "^7.2.5 || ^8.0",
28 | "psr/http-client": "^1.0",
29 | "symfony/deprecation-contracts": "^2.2 || ^3.0"
30 | },
31 | "provide": {
32 | "psr/http-client-implementation": "1.0"
33 | },
34 | "require-dev": {
35 | "bamarni/composer-bin-plugin": "^1.8.2",
36 | "ext-curl": "*",
37 | "guzzle/client-integration-tests": "3.0.2",
38 | "php-http/message-factory": "^1.1",
39 | "phpunit/phpunit": "^8.5.39 || ^9.6.20",
40 | "psr/log": "^1.1 || ^2.0 || ^3.0"
41 | },
42 | "suggest": {
43 | "ext-curl": "Required for CURL handler support",
44 | "ext-intl": "Required for Internationalized Domain Name (IDN) support",
45 | "psr/log": "Required for using the Log middleware"
46 | },
47 | "default-branch": true,
48 | "type": "library",
49 | "extra": {
50 | "bamarni-bin": {
51 | "bin-links": true,
52 | "forward-command": false
53 | }
54 | },
55 | "autoload": {
56 | "files": [
57 | "src/functions_include.php"
58 | ],
59 | "psr-4": {
60 | "GuzzleHttp\\": "src/"
61 | }
62 | },
63 | "notification-url": "https://packagist.org/downloads/",
64 | "license": [
65 | "MIT"
66 | ],
67 | "authors": [
68 | {
69 | "name": "Graham Campbell",
70 | "email": "hello@gjcampbell.co.uk",
71 | "homepage": "https://github.com/GrahamCampbell"
72 | },
73 | {
74 | "name": "Michael Dowling",
75 | "email": "mtdowling@gmail.com",
76 | "homepage": "https://github.com/mtdowling"
77 | },
78 | {
79 | "name": "Jeremy Lindblom",
80 | "email": "jeremeamia@gmail.com",
81 | "homepage": "https://github.com/jeremeamia"
82 | },
83 | {
84 | "name": "George Mponos",
85 | "email": "gmponos@gmail.com",
86 | "homepage": "https://github.com/gmponos"
87 | },
88 | {
89 | "name": "Tobias Nyholm",
90 | "email": "tobias.nyholm@gmail.com",
91 | "homepage": "https://github.com/Nyholm"
92 | },
93 | {
94 | "name": "Márk Sági-Kazár",
95 | "email": "mark.sagikazar@gmail.com",
96 | "homepage": "https://github.com/sagikazarmark"
97 | },
98 | {
99 | "name": "Tobias Schultze",
100 | "email": "webmaster@tubo-world.de",
101 | "homepage": "https://github.com/Tobion"
102 | }
103 | ],
104 | "description": "Guzzle is a PHP HTTP client library",
105 | "keywords": [
106 | "client",
107 | "curl",
108 | "framework",
109 | "http",
110 | "http client",
111 | "psr-18",
112 | "psr-7",
113 | "rest",
114 | "web service"
115 | ],
116 | "support": {
117 | "issues": "https://github.com/guzzle/guzzle/issues",
118 | "source": "https://github.com/guzzle/guzzle/tree/7.9.3"
119 | },
120 | "funding": [
121 | {
122 | "url": "https://github.com/GrahamCampbell",
123 | "type": "github"
124 | },
125 | {
126 | "url": "https://github.com/Nyholm",
127 | "type": "github"
128 | },
129 | {
130 | "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle",
131 | "type": "tidelift"
132 | }
133 | ],
134 | "time": "2025-03-27T13:37:11+00:00"
135 | },
136 | {
137 | "name": "guzzlehttp/promises",
138 | "version": "2.2.x-dev",
139 | "source": {
140 | "type": "git",
141 | "url": "https://github.com/guzzle/promises.git",
142 | "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c"
143 | },
144 | "dist": {
145 | "type": "zip",
146 | "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c",
147 | "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c",
148 | "shasum": ""
149 | },
150 | "require": {
151 | "php": "^7.2.5 || ^8.0"
152 | },
153 | "require-dev": {
154 | "bamarni/composer-bin-plugin": "^1.8.2",
155 | "phpunit/phpunit": "^8.5.39 || ^9.6.20"
156 | },
157 | "default-branch": true,
158 | "type": "library",
159 | "extra": {
160 | "bamarni-bin": {
161 | "bin-links": true,
162 | "forward-command": false
163 | }
164 | },
165 | "autoload": {
166 | "psr-4": {
167 | "GuzzleHttp\\Promise\\": "src/"
168 | }
169 | },
170 | "notification-url": "https://packagist.org/downloads/",
171 | "license": [
172 | "MIT"
173 | ],
174 | "authors": [
175 | {
176 | "name": "Graham Campbell",
177 | "email": "hello@gjcampbell.co.uk",
178 | "homepage": "https://github.com/GrahamCampbell"
179 | },
180 | {
181 | "name": "Michael Dowling",
182 | "email": "mtdowling@gmail.com",
183 | "homepage": "https://github.com/mtdowling"
184 | },
185 | {
186 | "name": "Tobias Nyholm",
187 | "email": "tobias.nyholm@gmail.com",
188 | "homepage": "https://github.com/Nyholm"
189 | },
190 | {
191 | "name": "Tobias Schultze",
192 | "email": "webmaster@tubo-world.de",
193 | "homepage": "https://github.com/Tobion"
194 | }
195 | ],
196 | "description": "Guzzle promises library",
197 | "keywords": [
198 | "promise"
199 | ],
200 | "support": {
201 | "issues": "https://github.com/guzzle/promises/issues",
202 | "source": "https://github.com/guzzle/promises/tree/2.2.0"
203 | },
204 | "funding": [
205 | {
206 | "url": "https://github.com/GrahamCampbell",
207 | "type": "github"
208 | },
209 | {
210 | "url": "https://github.com/Nyholm",
211 | "type": "github"
212 | },
213 | {
214 | "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises",
215 | "type": "tidelift"
216 | }
217 | ],
218 | "time": "2025-03-27T13:27:01+00:00"
219 | },
220 | {
221 | "name": "guzzlehttp/psr7",
222 | "version": "2.7.x-dev",
223 | "source": {
224 | "type": "git",
225 | "url": "https://github.com/guzzle/psr7.git",
226 | "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16"
227 | },
228 | "dist": {
229 | "type": "zip",
230 | "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16",
231 | "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16",
232 | "shasum": ""
233 | },
234 | "require": {
235 | "php": "^7.2.5 || ^8.0",
236 | "psr/http-factory": "^1.0",
237 | "psr/http-message": "^1.1 || ^2.0",
238 | "ralouphie/getallheaders": "^3.0"
239 | },
240 | "provide": {
241 | "psr/http-factory-implementation": "1.0",
242 | "psr/http-message-implementation": "1.0"
243 | },
244 | "require-dev": {
245 | "bamarni/composer-bin-plugin": "^1.8.2",
246 | "http-interop/http-factory-tests": "0.9.0",
247 | "phpunit/phpunit": "^8.5.39 || ^9.6.20"
248 | },
249 | "suggest": {
250 | "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
251 | },
252 | "default-branch": true,
253 | "type": "library",
254 | "extra": {
255 | "bamarni-bin": {
256 | "bin-links": true,
257 | "forward-command": false
258 | }
259 | },
260 | "autoload": {
261 | "psr-4": {
262 | "GuzzleHttp\\Psr7\\": "src/"
263 | }
264 | },
265 | "notification-url": "https://packagist.org/downloads/",
266 | "license": [
267 | "MIT"
268 | ],
269 | "authors": [
270 | {
271 | "name": "Graham Campbell",
272 | "email": "hello@gjcampbell.co.uk",
273 | "homepage": "https://github.com/GrahamCampbell"
274 | },
275 | {
276 | "name": "Michael Dowling",
277 | "email": "mtdowling@gmail.com",
278 | "homepage": "https://github.com/mtdowling"
279 | },
280 | {
281 | "name": "George Mponos",
282 | "email": "gmponos@gmail.com",
283 | "homepage": "https://github.com/gmponos"
284 | },
285 | {
286 | "name": "Tobias Nyholm",
287 | "email": "tobias.nyholm@gmail.com",
288 | "homepage": "https://github.com/Nyholm"
289 | },
290 | {
291 | "name": "Márk Sági-Kazár",
292 | "email": "mark.sagikazar@gmail.com",
293 | "homepage": "https://github.com/sagikazarmark"
294 | },
295 | {
296 | "name": "Tobias Schultze",
297 | "email": "webmaster@tubo-world.de",
298 | "homepage": "https://github.com/Tobion"
299 | },
300 | {
301 | "name": "Márk Sági-Kazár",
302 | "email": "mark.sagikazar@gmail.com",
303 | "homepage": "https://sagikazarmark.hu"
304 | }
305 | ],
306 | "description": "PSR-7 message implementation that also provides common utility methods",
307 | "keywords": [
308 | "http",
309 | "message",
310 | "psr-7",
311 | "request",
312 | "response",
313 | "stream",
314 | "uri",
315 | "url"
316 | ],
317 | "support": {
318 | "issues": "https://github.com/guzzle/psr7/issues",
319 | "source": "https://github.com/guzzle/psr7/tree/2.7.1"
320 | },
321 | "funding": [
322 | {
323 | "url": "https://github.com/GrahamCampbell",
324 | "type": "github"
325 | },
326 | {
327 | "url": "https://github.com/Nyholm",
328 | "type": "github"
329 | },
330 | {
331 | "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7",
332 | "type": "tidelift"
333 | }
334 | ],
335 | "time": "2025-03-27T12:30:47+00:00"
336 | },
337 | {
338 | "name": "hemant-mann/flysystem-dropbox",
339 | "version": "v1.0.5",
340 | "source": {
341 | "type": "git",
342 | "url": "https://github.com/Hemant-Mann/flysystem-dropbox.git",
343 | "reference": "9474c2ff047656efbbdc88d57bcacdbf9360a9ba"
344 | },
345 | "dist": {
346 | "type": "zip",
347 | "url": "https://api.github.com/repos/Hemant-Mann/flysystem-dropbox/zipball/9474c2ff047656efbbdc88d57bcacdbf9360a9ba",
348 | "reference": "9474c2ff047656efbbdc88d57bcacdbf9360a9ba",
349 | "shasum": ""
350 | },
351 | "require": {
352 | "kunalvarma05/dropbox-php-sdk": "^0.2.2|^0.3|^0.4",
353 | "league/flysystem": "^1.0",
354 | "php": ">=5.6.0"
355 | },
356 | "require-dev": {
357 | "phpunit/phpunit": "^5.7"
358 | },
359 | "type": "library",
360 | "autoload": {
361 | "psr-4": {
362 | "HemantMann\\Flysystem\\Dropbox\\": "src/"
363 | }
364 | },
365 | "license": [
366 | "MIT"
367 | ],
368 | "authors": [
369 | {
370 | "name": "Hemant Mann",
371 | "email": "hemant.mann121@gmail.com"
372 | }
373 | ],
374 | "description": "The Flysystem Adapter for Dropbox",
375 | "support": {
376 | "source": "https://github.com/Hemant-Mann/flysystem-dropbox/tree/v1.0.5",
377 | "issues": "https://github.com/Hemant-Mann/flysystem-dropbox/issues"
378 | },
379 | "time": "2022-08-01T04:30:34+00:00"
380 | },
381 | {
382 | "name": "illuminate/collections",
383 | "version": "8.x-dev",
384 | "source": {
385 | "type": "git",
386 | "url": "https://github.com/illuminate/collections.git",
387 | "reference": "705a4e1ef93cd492c45b9b3e7911cccc990a07f4"
388 | },
389 | "dist": {
390 | "type": "zip",
391 | "url": "https://api.github.com/repos/illuminate/collections/zipball/705a4e1ef93cd492c45b9b3e7911cccc990a07f4",
392 | "reference": "705a4e1ef93cd492c45b9b3e7911cccc990a07f4",
393 | "shasum": ""
394 | },
395 | "require": {
396 | "illuminate/contracts": "^8.0",
397 | "illuminate/macroable": "^8.0",
398 | "php": "^7.3|^8.0"
399 | },
400 | "suggest": {
401 | "symfony/var-dumper": "Required to use the dump method (^5.4)."
402 | },
403 | "type": "library",
404 | "extra": {
405 | "branch-alias": {
406 | "dev-master": "8.x-dev"
407 | }
408 | },
409 | "autoload": {
410 | "files": [
411 | "helpers.php"
412 | ],
413 | "psr-4": {
414 | "Illuminate\\Support\\": ""
415 | }
416 | },
417 | "notification-url": "https://packagist.org/downloads/",
418 | "license": [
419 | "MIT"
420 | ],
421 | "authors": [
422 | {
423 | "name": "Taylor Otwell",
424 | "email": "taylor@laravel.com"
425 | }
426 | ],
427 | "description": "The Illuminate Collections package.",
428 | "homepage": "https://laravel.com",
429 | "support": {
430 | "issues": "https://github.com/laravel/framework/issues",
431 | "source": "https://github.com/laravel/framework"
432 | },
433 | "time": "2022-06-23T15:29:49+00:00"
434 | },
435 | {
436 | "name": "illuminate/contracts",
437 | "version": "8.x-dev",
438 | "source": {
439 | "type": "git",
440 | "url": "https://github.com/illuminate/contracts.git",
441 | "reference": "5e0fd287a1b22a6b346a9f7cd484d8cf0234585d"
442 | },
443 | "dist": {
444 | "type": "zip",
445 | "url": "https://api.github.com/repos/illuminate/contracts/zipball/5e0fd287a1b22a6b346a9f7cd484d8cf0234585d",
446 | "reference": "5e0fd287a1b22a6b346a9f7cd484d8cf0234585d",
447 | "shasum": ""
448 | },
449 | "require": {
450 | "php": "^7.3|^8.0",
451 | "psr/container": "^1.0",
452 | "psr/simple-cache": "^1.0"
453 | },
454 | "type": "library",
455 | "extra": {
456 | "branch-alias": {
457 | "dev-master": "8.x-dev"
458 | }
459 | },
460 | "autoload": {
461 | "psr-4": {
462 | "Illuminate\\Contracts\\": ""
463 | }
464 | },
465 | "notification-url": "https://packagist.org/downloads/",
466 | "license": [
467 | "MIT"
468 | ],
469 | "authors": [
470 | {
471 | "name": "Taylor Otwell",
472 | "email": "taylor@laravel.com"
473 | }
474 | ],
475 | "description": "The Illuminate Contracts package.",
476 | "homepage": "https://laravel.com",
477 | "support": {
478 | "issues": "https://github.com/laravel/framework/issues",
479 | "source": "https://github.com/laravel/framework"
480 | },
481 | "time": "2022-01-13T14:47:47+00:00"
482 | },
483 | {
484 | "name": "illuminate/macroable",
485 | "version": "8.x-dev",
486 | "source": {
487 | "type": "git",
488 | "url": "https://github.com/illuminate/macroable.git",
489 | "reference": "aed81891a6e046fdee72edd497f822190f61c162"
490 | },
491 | "dist": {
492 | "type": "zip",
493 | "url": "https://api.github.com/repos/illuminate/macroable/zipball/aed81891a6e046fdee72edd497f822190f61c162",
494 | "reference": "aed81891a6e046fdee72edd497f822190f61c162",
495 | "shasum": ""
496 | },
497 | "require": {
498 | "php": "^7.3|^8.0"
499 | },
500 | "type": "library",
501 | "extra": {
502 | "branch-alias": {
503 | "dev-master": "8.x-dev"
504 | }
505 | },
506 | "autoload": {
507 | "psr-4": {
508 | "Illuminate\\Support\\": ""
509 | }
510 | },
511 | "notification-url": "https://packagist.org/downloads/",
512 | "license": [
513 | "MIT"
514 | ],
515 | "authors": [
516 | {
517 | "name": "Taylor Otwell",
518 | "email": "taylor@laravel.com"
519 | }
520 | ],
521 | "description": "The Illuminate Macroable package.",
522 | "homepage": "https://laravel.com",
523 | "support": {
524 | "issues": "https://github.com/laravel/framework/issues",
525 | "source": "https://github.com/laravel/framework"
526 | },
527 | "time": "2021-11-16T13:57:03+00:00"
528 | },
529 | {
530 | "name": "kunalvarma05/dropbox-php-sdk",
531 | "version": "v0.4.2",
532 | "source": {
533 | "type": "git",
534 | "url": "https://github.com/kunalvarma05/dropbox-php-sdk.git",
535 | "reference": "446858ae31c8ebf88c51d93761c7f6520de41a21"
536 | },
537 | "dist": {
538 | "type": "zip",
539 | "url": "https://api.github.com/repos/kunalvarma05/dropbox-php-sdk/zipball/446858ae31c8ebf88c51d93761c7f6520de41a21",
540 | "reference": "446858ae31c8ebf88c51d93761c7f6520de41a21",
541 | "shasum": ""
542 | },
543 | "require": {
544 | "guzzlehttp/guzzle": "~6.0|~7.0",
545 | "illuminate/collections": "^8.0|^9.0|^10.0"
546 | },
547 | "require-dev": {
548 | "phpunit/phpunit": "^6.0"
549 | },
550 | "type": "library",
551 | "autoload": {
552 | "psr-4": {
553 | "Kunnu\\Dropbox\\": "src/Dropbox"
554 | }
555 | },
556 | "notification-url": "https://packagist.org/downloads/",
557 | "license": [
558 | "MIT"
559 | ],
560 | "authors": [
561 | {
562 | "name": "Kunal Varma",
563 | "email": "kunalvarma05@gmail.com"
564 | }
565 | ],
566 | "description": "Dropbox PHP API V2 SDK (Unofficial)",
567 | "keywords": [
568 | "api",
569 | "client",
570 | "dropbox",
571 | "php",
572 | "sdk",
573 | "unofficial"
574 | ],
575 | "support": {
576 | "issues": "https://github.com/kunalvarma05/dropbox-php-sdk/issues",
577 | "source": "https://github.com/kunalvarma05/dropbox-php-sdk/tree/v0.4.2"
578 | },
579 | "time": "2023-03-02T04:58:28+00:00"
580 | },
581 | {
582 | "name": "league/flysystem",
583 | "version": "1.x-dev",
584 | "source": {
585 | "type": "git",
586 | "url": "https://github.com/thephpleague/flysystem.git",
587 | "reference": "3239285c825c152bcc315fe0e87d6b55f5972ed1"
588 | },
589 | "dist": {
590 | "type": "zip",
591 | "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/3239285c825c152bcc315fe0e87d6b55f5972ed1",
592 | "reference": "3239285c825c152bcc315fe0e87d6b55f5972ed1",
593 | "shasum": ""
594 | },
595 | "require": {
596 | "ext-fileinfo": "*",
597 | "league/mime-type-detection": "^1.3",
598 | "php": "^7.2.5 || ^8.0"
599 | },
600 | "conflict": {
601 | "league/flysystem-sftp": "<1.0.6"
602 | },
603 | "require-dev": {
604 | "phpspec/prophecy": "^1.11.1",
605 | "phpunit/phpunit": "^8.5.8"
606 | },
607 | "suggest": {
608 | "ext-ftp": "Allows you to use FTP server storage",
609 | "ext-openssl": "Allows you to use FTPS server storage",
610 | "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2",
611 | "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3",
612 | "league/flysystem-azure": "Allows you to use Windows Azure Blob storage",
613 | "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching",
614 | "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem",
615 | "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files",
616 | "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib",
617 | "league/flysystem-webdav": "Allows you to use WebDAV storage",
618 | "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter",
619 | "spatie/flysystem-dropbox": "Allows you to use Dropbox storage",
620 | "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications"
621 | },
622 | "type": "library",
623 | "extra": {
624 | "branch-alias": {
625 | "dev-master": "1.1-dev"
626 | }
627 | },
628 | "autoload": {
629 | "psr-4": {
630 | "League\\Flysystem\\": "src/"
631 | }
632 | },
633 | "notification-url": "https://packagist.org/downloads/",
634 | "license": [
635 | "MIT"
636 | ],
637 | "authors": [
638 | {
639 | "name": "Frank de Jonge",
640 | "email": "info@frenky.net"
641 | }
642 | ],
643 | "description": "Filesystem abstraction: Many filesystems, one API.",
644 | "keywords": [
645 | "Cloud Files",
646 | "WebDAV",
647 | "abstraction",
648 | "aws",
649 | "cloud",
650 | "copy.com",
651 | "dropbox",
652 | "file systems",
653 | "files",
654 | "filesystem",
655 | "filesystems",
656 | "ftp",
657 | "rackspace",
658 | "remote",
659 | "s3",
660 | "sftp",
661 | "storage"
662 | ],
663 | "support": {
664 | "issues": "https://github.com/thephpleague/flysystem/issues",
665 | "source": "https://github.com/thephpleague/flysystem/tree/1.x"
666 | },
667 | "funding": [
668 | {
669 | "url": "https://offset.earth/frankdejonge",
670 | "type": "other"
671 | }
672 | ],
673 | "time": "2022-10-04T09:16:37+00:00"
674 | },
675 | {
676 | "name": "league/mime-type-detection",
677 | "version": "1.16.0",
678 | "source": {
679 | "type": "git",
680 | "url": "https://github.com/thephpleague/mime-type-detection.git",
681 | "reference": "2d6702ff215bf922936ccc1ad31007edc76451b9"
682 | },
683 | "dist": {
684 | "type": "zip",
685 | "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/2d6702ff215bf922936ccc1ad31007edc76451b9",
686 | "reference": "2d6702ff215bf922936ccc1ad31007edc76451b9",
687 | "shasum": ""
688 | },
689 | "require": {
690 | "ext-fileinfo": "*",
691 | "php": "^7.4 || ^8.0"
692 | },
693 | "require-dev": {
694 | "friendsofphp/php-cs-fixer": "^3.2",
695 | "phpstan/phpstan": "^0.12.68",
696 | "phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0"
697 | },
698 | "type": "library",
699 | "autoload": {
700 | "psr-4": {
701 | "League\\MimeTypeDetection\\": "src"
702 | }
703 | },
704 | "notification-url": "https://packagist.org/downloads/",
705 | "license": [
706 | "MIT"
707 | ],
708 | "authors": [
709 | {
710 | "name": "Frank de Jonge",
711 | "email": "info@frankdejonge.nl"
712 | }
713 | ],
714 | "description": "Mime-type detection for Flysystem",
715 | "support": {
716 | "issues": "https://github.com/thephpleague/mime-type-detection/issues",
717 | "source": "https://github.com/thephpleague/mime-type-detection/tree/1.16.0"
718 | },
719 | "funding": [
720 | {
721 | "url": "https://github.com/frankdejonge",
722 | "type": "github"
723 | },
724 | {
725 | "url": "https://tidelift.com/funding/github/packagist/league/flysystem",
726 | "type": "tidelift"
727 | }
728 | ],
729 | "time": "2024-09-21T08:32:55+00:00"
730 | },
731 | {
732 | "name": "psr/container",
733 | "version": "1.x-dev",
734 | "source": {
735 | "type": "git",
736 | "url": "https://github.com/php-fig/container.git",
737 | "reference": "513e0666f7216c7459170d56df27dfcefe1689ea"
738 | },
739 | "dist": {
740 | "type": "zip",
741 | "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea",
742 | "reference": "513e0666f7216c7459170d56df27dfcefe1689ea",
743 | "shasum": ""
744 | },
745 | "require": {
746 | "php": ">=7.4.0"
747 | },
748 | "type": "library",
749 | "autoload": {
750 | "psr-4": {
751 | "Psr\\Container\\": "src/"
752 | }
753 | },
754 | "notification-url": "https://packagist.org/downloads/",
755 | "license": [
756 | "MIT"
757 | ],
758 | "authors": [
759 | {
760 | "name": "PHP-FIG",
761 | "homepage": "https://www.php-fig.org/"
762 | }
763 | ],
764 | "description": "Common Container Interface (PHP FIG PSR-11)",
765 | "homepage": "https://github.com/php-fig/container",
766 | "keywords": [
767 | "PSR-11",
768 | "container",
769 | "container-interface",
770 | "container-interop",
771 | "psr"
772 | ],
773 | "support": {
774 | "issues": "https://github.com/php-fig/container/issues",
775 | "source": "https://github.com/php-fig/container/tree/1.1.2"
776 | },
777 | "time": "2021-11-05T16:50:12+00:00"
778 | },
779 | {
780 | "name": "psr/http-client",
781 | "version": "dev-master",
782 | "source": {
783 | "type": "git",
784 | "url": "https://github.com/php-fig/http-client.git",
785 | "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90"
786 | },
787 | "dist": {
788 | "type": "zip",
789 | "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90",
790 | "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90",
791 | "shasum": ""
792 | },
793 | "require": {
794 | "php": "^7.0 || ^8.0",
795 | "psr/http-message": "^1.0 || ^2.0"
796 | },
797 | "default-branch": true,
798 | "type": "library",
799 | "extra": {
800 | "branch-alias": {
801 | "dev-master": "1.0.x-dev"
802 | }
803 | },
804 | "autoload": {
805 | "psr-4": {
806 | "Psr\\Http\\Client\\": "src/"
807 | }
808 | },
809 | "notification-url": "https://packagist.org/downloads/",
810 | "license": [
811 | "MIT"
812 | ],
813 | "authors": [
814 | {
815 | "name": "PHP-FIG",
816 | "homepage": "https://www.php-fig.org/"
817 | }
818 | ],
819 | "description": "Common interface for HTTP clients",
820 | "homepage": "https://github.com/php-fig/http-client",
821 | "keywords": [
822 | "http",
823 | "http-client",
824 | "psr",
825 | "psr-18"
826 | ],
827 | "support": {
828 | "source": "https://github.com/php-fig/http-client"
829 | },
830 | "time": "2023-09-23T14:17:50+00:00"
831 | },
832 | {
833 | "name": "psr/http-factory",
834 | "version": "1.1.0",
835 | "source": {
836 | "type": "git",
837 | "url": "https://github.com/php-fig/http-factory.git",
838 | "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a"
839 | },
840 | "dist": {
841 | "type": "zip",
842 | "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
843 | "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
844 | "shasum": ""
845 | },
846 | "require": {
847 | "php": ">=7.1",
848 | "psr/http-message": "^1.0 || ^2.0"
849 | },
850 | "type": "library",
851 | "extra": {
852 | "branch-alias": {
853 | "dev-master": "1.0.x-dev"
854 | }
855 | },
856 | "autoload": {
857 | "psr-4": {
858 | "Psr\\Http\\Message\\": "src/"
859 | }
860 | },
861 | "notification-url": "https://packagist.org/downloads/",
862 | "license": [
863 | "MIT"
864 | ],
865 | "authors": [
866 | {
867 | "name": "PHP-FIG",
868 | "homepage": "https://www.php-fig.org/"
869 | }
870 | ],
871 | "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories",
872 | "keywords": [
873 | "factory",
874 | "http",
875 | "message",
876 | "psr",
877 | "psr-17",
878 | "psr-7",
879 | "request",
880 | "response"
881 | ],
882 | "support": {
883 | "source": "https://github.com/php-fig/http-factory"
884 | },
885 | "time": "2024-04-15T12:06:14+00:00"
886 | },
887 | {
888 | "name": "psr/http-message",
889 | "version": "dev-master",
890 | "source": {
891 | "type": "git",
892 | "url": "https://github.com/php-fig/http-message.git",
893 | "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71"
894 | },
895 | "dist": {
896 | "type": "zip",
897 | "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71",
898 | "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71",
899 | "shasum": ""
900 | },
901 | "require": {
902 | "php": "^7.2 || ^8.0"
903 | },
904 | "default-branch": true,
905 | "type": "library",
906 | "extra": {
907 | "branch-alias": {
908 | "dev-master": "2.0.x-dev"
909 | }
910 | },
911 | "autoload": {
912 | "psr-4": {
913 | "Psr\\Http\\Message\\": "src/"
914 | }
915 | },
916 | "notification-url": "https://packagist.org/downloads/",
917 | "license": [
918 | "MIT"
919 | ],
920 | "authors": [
921 | {
922 | "name": "PHP-FIG",
923 | "homepage": "https://www.php-fig.org/"
924 | }
925 | ],
926 | "description": "Common interface for HTTP messages",
927 | "homepage": "https://github.com/php-fig/http-message",
928 | "keywords": [
929 | "http",
930 | "http-message",
931 | "psr",
932 | "psr-7",
933 | "request",
934 | "response"
935 | ],
936 | "support": {
937 | "source": "https://github.com/php-fig/http-message/tree/2.0"
938 | },
939 | "time": "2023-04-04T09:54:51+00:00"
940 | },
941 | {
942 | "name": "psr/simple-cache",
943 | "version": "1.0.1",
944 | "source": {
945 | "type": "git",
946 | "url": "https://github.com/php-fig/simple-cache.git",
947 | "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b"
948 | },
949 | "dist": {
950 | "type": "zip",
951 | "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
952 | "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
953 | "shasum": ""
954 | },
955 | "require": {
956 | "php": ">=5.3.0"
957 | },
958 | "type": "library",
959 | "extra": {
960 | "branch-alias": {
961 | "dev-master": "1.0.x-dev"
962 | }
963 | },
964 | "autoload": {
965 | "psr-4": {
966 | "Psr\\SimpleCache\\": "src/"
967 | }
968 | },
969 | "notification-url": "https://packagist.org/downloads/",
970 | "license": [
971 | "MIT"
972 | ],
973 | "authors": [
974 | {
975 | "name": "PHP-FIG",
976 | "homepage": "http://www.php-fig.org/"
977 | }
978 | ],
979 | "description": "Common interfaces for simple caching",
980 | "keywords": [
981 | "cache",
982 | "caching",
983 | "psr",
984 | "psr-16",
985 | "simple-cache"
986 | ],
987 | "support": {
988 | "source": "https://github.com/php-fig/simple-cache/tree/master"
989 | },
990 | "time": "2017-10-23T01:57:42+00:00"
991 | },
992 | {
993 | "name": "ralouphie/getallheaders",
994 | "version": "3.0.3",
995 | "source": {
996 | "type": "git",
997 | "url": "https://github.com/ralouphie/getallheaders.git",
998 | "reference": "120b605dfeb996808c31b6477290a714d356e822"
999 | },
1000 | "dist": {
1001 | "type": "zip",
1002 | "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
1003 | "reference": "120b605dfeb996808c31b6477290a714d356e822",
1004 | "shasum": ""
1005 | },
1006 | "require": {
1007 | "php": ">=5.6"
1008 | },
1009 | "require-dev": {
1010 | "php-coveralls/php-coveralls": "^2.1",
1011 | "phpunit/phpunit": "^5 || ^6.5"
1012 | },
1013 | "type": "library",
1014 | "autoload": {
1015 | "files": [
1016 | "src/getallheaders.php"
1017 | ]
1018 | },
1019 | "notification-url": "https://packagist.org/downloads/",
1020 | "license": [
1021 | "MIT"
1022 | ],
1023 | "authors": [
1024 | {
1025 | "name": "Ralph Khattar",
1026 | "email": "ralph.khattar@gmail.com"
1027 | }
1028 | ],
1029 | "description": "A polyfill for getallheaders.",
1030 | "support": {
1031 | "issues": "https://github.com/ralouphie/getallheaders/issues",
1032 | "source": "https://github.com/ralouphie/getallheaders/tree/develop"
1033 | },
1034 | "time": "2019-03-08T08:55:37+00:00"
1035 | },
1036 | {
1037 | "name": "symfony/deprecation-contracts",
1038 | "version": "2.5.x-dev",
1039 | "source": {
1040 | "type": "git",
1041 | "url": "https://github.com/symfony/deprecation-contracts.git",
1042 | "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918"
1043 | },
1044 | "dist": {
1045 | "type": "zip",
1046 | "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918",
1047 | "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918",
1048 | "shasum": ""
1049 | },
1050 | "require": {
1051 | "php": ">=7.1"
1052 | },
1053 | "type": "library",
1054 | "extra": {
1055 | "thanks": {
1056 | "url": "https://github.com/symfony/contracts",
1057 | "name": "symfony/contracts"
1058 | },
1059 | "branch-alias": {
1060 | "dev-main": "2.5-dev"
1061 | }
1062 | },
1063 | "autoload": {
1064 | "files": [
1065 | "function.php"
1066 | ]
1067 | },
1068 | "notification-url": "https://packagist.org/downloads/",
1069 | "license": [
1070 | "MIT"
1071 | ],
1072 | "authors": [
1073 | {
1074 | "name": "Nicolas Grekas",
1075 | "email": "p@tchwork.com"
1076 | },
1077 | {
1078 | "name": "Symfony Community",
1079 | "homepage": "https://symfony.com/contributors"
1080 | }
1081 | ],
1082 | "description": "A generic function and convention to trigger deprecation notices",
1083 | "homepage": "https://symfony.com",
1084 | "support": {
1085 | "source": "https://github.com/symfony/deprecation-contracts/tree/2.5"
1086 | },
1087 | "funding": [
1088 | {
1089 | "url": "https://symfony.com/sponsor",
1090 | "type": "custom"
1091 | },
1092 | {
1093 | "url": "https://github.com/fabpot",
1094 | "type": "github"
1095 | },
1096 | {
1097 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
1098 | "type": "tidelift"
1099 | }
1100 | ],
1101 | "time": "2024-09-25T14:11:13+00:00"
1102 | }
1103 | ],
1104 | "packages-dev": [],
1105 | "aliases": [],
1106 | "minimum-stability": "dev",
1107 | "stability-flags": {},
1108 | "prefer-stable": false,
1109 | "prefer-lowest": false,
1110 | "platform": {},
1111 | "platform-dev": {},
1112 | "plugin-api-version": "2.6.0"
1113 | }
1114 |
--------------------------------------------------------------------------------
/js/dropbox.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function () {
2 | var backendId = 'files_external_dropbox';
3 | var backendUrl = OC.generateUrl('apps/' + backendId + '/oauth');
4 |
5 | function displayGranted ($tr) {
6 | $tr.find('.configuration input.auth-param').attr('disabled', 'disabled').addClass('disabled-success');
7 | }
8 |
9 | OCA.Files_External.Settings.mountConfig.whenSelectAuthMechanism(function ($tr, authMechanism, scheme, onCompletion) {
10 | if (authMechanism === 'oauth2::oauth2' &&
11 | $tr.hasClass('files_external_dropbox')) {
12 | var config = $tr.find('.configuration');
13 | // hack to prevent conflict with oauth2 code from files_external
14 | // wait for files_external to setup the config ui and then change the button
15 | setTimeout(function () {
16 | config.find('[name="oauth2_grant"]')
17 | .attr('name', 'oauth2_grant_dropbox');
18 | }, 50);
19 |
20 | onCompletion.then(function () {
21 | var configured = $tr.find('[data-parameter="configured"]');
22 | if ($(configured).val() == 'true') {
23 | displayGranted($tr);
24 | } else {
25 | var client_id = $tr.find('.configuration [data-parameter="client_id"]').val();
26 | var client_secret = $tr.find('.configuration [data-parameter="client_secret"]').val();
27 | if (localStorage.getItem('files_external_dropbox_oauth2')) {
28 | client_secret = atob(localStorage.getItem('files_external_dropbox_oauth2'));
29 | localStorage.removeItem('files_external_dropbox_oauth2');
30 | }
31 |
32 | var params = {};
33 | window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {
34 | params[key] = value;
35 | });
36 |
37 | if (
38 | params.code !== undefined
39 | && typeof client_id === "string"
40 | && client_id !== ''
41 | && typeof client_secret === "string"
42 | && client_secret !== ''
43 | ) {
44 | $('.configuration').trigger('dropbox_oauth_step2', [{
45 | backend_id: $tr.attr('class'),
46 | client_id: client_id,
47 | client_secret: client_secret,
48 | redirect: location.protocol + '//' + location.host + location.pathname,
49 | tr: $tr,
50 | code: params.code || '',
51 | state: params.state || ''
52 | }]);
53 | }
54 | }
55 | });
56 | }
57 | });
58 |
59 | $('#externalStorage').on('click', '[name="oauth2_grant_dropbox"]', function (event) {
60 | event.preventDefault();
61 | var tr = $(this).parent().parent();
62 | var client_id = $(this).parent().find('[data-parameter="client_id"]').val();
63 | var client_secret = $(this).parent().find('[data-parameter="client_secret"]').val();
64 |
65 | if (client_id !== '' && client_secret !== '') {
66 | $('.configuration').trigger('dropbox_oauth_step1', [{
67 | backend_id: tr.attr('class'),
68 | client_id: client_id,
69 | client_secret: client_secret,
70 | redirect: location.protocol + '//' + location.host + location.pathname,
71 | tr: tr
72 | }]);
73 | }
74 | });
75 |
76 | $('.configuration').on('dropbox_oauth_step1', function (event, data) {
77 | if (data['backend_id'] !== backendId) {
78 | return false; // means the trigger is not for this storage adapter
79 | }
80 |
81 | OCA.Files_External.Settings.OAuth2.getDropboxAuthUrl(backendUrl, data);
82 | });
83 |
84 | $('.configuration').on('dropbox_oauth_step2', function (event, data) {
85 | if (data['backend_id'] !== backendId || data['code'] === undefined) {
86 | return false; // means the trigger is not for this OAuth2 grant
87 | }
88 |
89 | OCA.Files_External.Settings.OAuth2.dropboxVerifyCode(backendUrl, data)
90 | .fail(function (message) {
91 | OC.dialogs.alert(message,
92 | t(backendId, 'Error verifying OAuth2 Code for ' + backendId)
93 | );
94 | })
95 | });
96 | });
97 |
98 | /**
99 | * @namespace OAuth2 namespace which is used to verify a storage adapter
100 | * using AuthMechanism as oauth2::oauth2
101 | */
102 | OCA.Files_External.Settings.OAuth2 = OCA.Files_External.Settings.OAuth2 || {};
103 |
104 | /**
105 | * This function sends a request to the given backendUrl and gets the OAuth2 URL
106 | * for any given backend storage, executes the callback if any, set the data-* parameters
107 | * of the storage and REDIRECTS the client to Authentication page
108 | *
109 | * @param {String} backendUrl The backend URL to which request will be sent
110 | * @param {Object} data Keys -> (backend_id, client_id, client_secret, redirect, tr)
111 | */
112 | OCA.Files_External.Settings.OAuth2.getDropboxAuthUrl = function (backendUrl, data) {
113 | var $tr = data['tr'];
114 | var configured = $tr.find('[data-parameter="configured"]');
115 | var token = $tr.find('.configuration [data-parameter="token"]');
116 |
117 | $.post(backendUrl, {
118 | step: 1,
119 | client_id: data['client_id'],
120 | client_secret: data['client_secret'],
121 | redirect: data['redirect'],
122 | }, function (result) {
123 | if (result && result.status == 'success') {
124 | $(configured).val('false');
125 | $(token).val('false');
126 |
127 | OCA.Files_External.Settings.mountConfig.saveStorageConfig($tr, function (status) {
128 | if (!result.data.url) {
129 | OC.dialogs.alert('Auth URL not set',
130 | t('files_external', 'No URL provided by backend ' + data['backend_id'])
131 | );
132 | } else {
133 | localStorage.setItem('files_external_dropbox_oauth2', btoa(data['client_secret']));
134 | window.location = result.data.url;
135 | }
136 | });
137 | } else {
138 | OC.dialogs.alert(result.data.message,
139 | t('files_external', 'Error getting OAuth2 URL for ' + data['backend_id'])
140 | );
141 | }
142 | }
143 | );
144 | };
145 |
146 | /**
147 | * This function verifies the OAuth2 code returned to the client after verification
148 | * by sending request to the backend with the given CODE and if the code is verified
149 | * it sets the data-* params to configured and disables the authorize buttons
150 | *
151 | * @param {String} backendUrl The backend URL to which request will be sent
152 | * @param {Object} data Keys -> (backend_id, client_id, client_secret, redirect, tr, code)
153 | * @return {Promise} jQuery Deferred Promise object
154 | */
155 | OCA.Files_External.Settings.OAuth2.dropboxVerifyCode = function (backendUrl, data) {
156 | var $tr = data['tr'];
157 | var configured = $tr.find('[data-parameter="configured"]');
158 | var token = $tr.find('.configuration [data-parameter="token"]');
159 | var statusSpan = $tr.find('.status span');
160 | statusSpan.removeClass().addClass('waiting');
161 |
162 | var deferredObject = $.Deferred();
163 | $.post(backendUrl, {
164 | step: 2,
165 | client_id: data['client_id'],
166 | client_secret: data['client_secret'],
167 | redirect: data['redirect'],
168 | code: data['code'],
169 | state: data['state']
170 | }, function (result) {
171 | if (result && result.status == 'success') {
172 | $(token).val(result.data.token);
173 | $(configured).val('true');
174 |
175 | OCA.Files_External.Settings.mountConfig.saveStorageConfig($tr, function (status) {
176 | if (status) {
177 | $tr.find('.configuration input.auth-param')
178 | .attr('disabled', 'disabled')
179 | .addClass('disabled-success')
180 | }
181 | deferredObject.resolve(status);
182 | });
183 | } else {
184 | deferredObject.reject(result.data.message);
185 | }
186 | }
187 | );
188 | return deferredObject.promise();
189 | };
190 |
--------------------------------------------------------------------------------
/l10n/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJaeger/files_external_dropbox/f6c1c6c1ef3e39e91ece59efc170fd8f95a87882/l10n/.gitkeep
--------------------------------------------------------------------------------
/l10n/en_GB.js:
--------------------------------------------------------------------------------
1 | OC.L10N.register(
2 | "files_external_dropbox",
3 | {
4 | "Dropbox" : "Dropbox",
5 | "Client Id" : "Client Id",
6 | "Client Secret" : "Client Secret",
7 | "Token" : "Token"
8 | },
9 | "nplurals=2; plural=(n != 1);"
10 | );
11 |
--------------------------------------------------------------------------------
/l10n/en_GB.json:
--------------------------------------------------------------------------------
1 | {
2 | "translations": {
3 | "Dropbox" : "Dropbox",
4 | "Client Id" : "Client Id",
5 | "Client Secret" : "Client Secret",
6 | "Token" : "Token"
7 | },
8 | "pluralForm" :"nplurals=2; plural=(n != 1);"
9 | }
--------------------------------------------------------------------------------
/lib/AppInfo/Application.php:
--------------------------------------------------------------------------------
1 |
4 | *
5 | * @copyright Copyright (c) 2017, ownCloud GmbH.
6 | * @license AGPL-3.0
7 | *
8 | * This code is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Affero General Public License, version 3,
10 | * as published by the Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Affero General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Affero General Public License, version 3,
18 | * along with this program. If not, see
19 | *
20 | */
21 |
22 | namespace OCA\Files_external_dropbox\AppInfo;
23 |
24 | use OCA\Files_External\Lib\Config\IBackendProvider;
25 | use OCA\Files_External\Service\BackendService;
26 | use OCP\AppFramework\App;
27 |
28 | /**
29 | * @package OCA\Files_external_dropbox\AppInfo
30 | */
31 | class Application extends App implements IBackendProvider {
32 |
33 | public function __construct(array $urlParams = []) {
34 | parent::__construct('files_external_dropbox', $urlParams);
35 | }
36 |
37 | /**
38 | * @{inheritdoc}
39 | */
40 | public function getBackends() {
41 | $container = $this->getContainer();
42 |
43 | $backends = [
44 | $container->query('OCA\Files_external_dropbox\Backend\Dropbox')
45 | ];
46 | return $backends;
47 | }
48 |
49 | public function register() {
50 |
51 | $container = $this->getContainer();
52 | $server = $container->getServer();
53 |
54 | /** @var BackendService $backendService */
55 | $backendService = $server->query('OCA\\Files_External\\Service\\BackendService');
56 | $backendService->registerBackendProvider($this);
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/lib/Backend/Dropbox.php:
--------------------------------------------------------------------------------
1 |
4 | *
5 | * @copyright Copyright (c) 2017, ownCloud GmbH.
6 | * @license AGPL-3.0
7 | *
8 | * This code is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Affero General Public License, version 3,
10 | * as published by the Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Affero General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Affero General Public License, version 3,
18 | * along with this program. If not, see
19 | *
20 | */
21 |
22 | namespace OCA\Files_external_dropbox\Backend;
23 |
24 | use OCA\Files_External\Lib\Auth\AuthMechanism;
25 | use OCA\Files_External\Lib\Backend\Backend;
26 | use OCP\IL10N;
27 |
28 | class Dropbox extends Backend {
29 |
30 | /**
31 | * Dropbox constructor.
32 | *
33 | * @param IL10N $l
34 | */
35 | public function __construct(IL10N $l) {
36 | $appWebPath = \OC_App::getAppWebPath('files_external_dropbox');
37 |
38 | $this
39 | ->setIdentifier('files_external_dropbox')
40 | ->addIdentifierAlias('\OC\Files\External_Storage\Dropbox')// legacy compat
41 | ->setStorageClass('\OCA\Files_external_dropbox\Storage\Dropbox')
42 | ->setText($l->t('Dropbox V2'))
43 | ->addParameters([
44 |
45 | ])
46 | ->addAuthScheme(AuthMechanism::SCHEME_OAUTH2)
47 | ->addCustomJs("../../../$appWebPath/js/dropbox");
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/lib/BackgroundJob/MetaData.php:
--------------------------------------------------------------------------------
1 |
4 | *
5 | * @copyright Copyright (c) 2017, ownCloud GmbH.
6 | * @license AGPL-3.0
7 | *
8 | * This code is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Affero General Public License, version 3,
10 | * as published by the Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Affero General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Affero General Public License, version 3,
18 | * along with this program. If not, see
19 | *
20 | */
21 |
22 | namespace OCA\Files_external_dropbox\BackgroundJob;
23 |
24 |
25 | use OCA\Files_External\Lib\StorageConfig;
26 | use OCP\IConfig;
27 | use OCP\IDBConnection;
28 | use OCP\ILogger;
29 | use OCP\IUser;
30 | use OCP\IUserManager;
31 | use OC\Files\Utils\Scanner;
32 | use OC\BackgroundJob\TimedJob;
33 |
34 | class MetaData extends TimedJob {
35 | /** @var IConfig */
36 | private $config;
37 | /** @var IUserManager */
38 | private $userManager;
39 | /** @var IDBConnection */
40 | private $dbConnection;
41 | /** @var ILogger */
42 | private $logger;
43 | /** Amount of users that should get scanned per execution */
44 | const USERS_PER_SESSION = 500;
45 |
46 | private $appName = 'files_external_dropbox';
47 |
48 | /**
49 | * @param IConfig|null $config
50 | * @param IUserManager|null $userManager
51 | * @param IDBConnection|null $dbConnection
52 | * @param ILogger|null $logger
53 | */
54 | public function __construct(IConfig $config = null,
55 | IUserManager $userManager = null,
56 | IDBConnection $dbConnection = null,
57 | ILogger $logger = null) {
58 | // Run once per 10 minutes
59 | $this->setInterval(1);
60 | if (is_null($userManager) || is_null($config)) {
61 | $this->fixDIForJobs();
62 | } else {
63 | $this->config = $config;
64 | $this->userManager = $userManager;
65 | $this->logger = $logger;
66 | }
67 | }
68 |
69 | protected function fixDIForJobs() {
70 | $this->config = \OC::$server->getConfig();
71 | $this->userManager = \OC::$server->getUserManager();
72 | $this->logger = \OC::$server->getLogger();
73 | }
74 |
75 | /**
76 | * Get the storage configuration and sync the storage only if configured = true
77 | * Instantiate new Dropbox Storage class, Check for the last stored cursor
78 | * if found then check if the storage is updated and scan the modified folders
79 | * else scan the whole storage
80 | *
81 | * @param StorageConfig $storageConfig
82 | * @return boolean True on success, False on failure
83 | */
84 | protected function syncStorage(StorageConfig $storageConfig) {
85 | $opts = $storageConfig->getBackendOptions();
86 | if ($opts['configured'] === 'false') {
87 | return false;
88 | }
89 | try {
90 | $storage = new \OCA\Files_external_dropbox\Storage\Dropbox($opts);
91 | $key = 'dropbox_cursor_storage_' . $storageConfig->getId();
92 |
93 | $cursor = $this->config->getAppValue($this->appName, $key, null);
94 | if ($cursor && $isUpdated = $storage->isStorageUpdated($cursor)) {
95 | $directories = $storage->getModifiedPaths($cursor);
96 | foreach ($directories as $directory) {
97 | $result = $storage->getScanner()->scan($directory, true);
98 | }
99 | $cursor = $storage->getLatestCursor();
100 | } else {
101 | $cursor = $storage->getLatestCursor();
102 | $storage->getScanner()->scan('/', true);
103 | }
104 | $this->config->setAppValue($this->appName, $key, $cursor);
105 | } catch (\Exception $e) {
106 | $this->logger->logException($e, ['message' => 'Storage Syncing failed for ' . $storageConfig->getId()]);
107 | return false;
108 | }
109 | return true;
110 | }
111 |
112 | public function run($argument) {
113 | $service = \OC::$server->getGlobalStoragesService();
114 | $resp = $service->getAllStorages();
115 | $result = [];
116 | foreach ($resp as $r) {
117 | $data = $r->getBackend()->jsonSerialize();
118 | if ($data['identifier'] === $this->appName) {
119 | $result[] = $r;
120 | }
121 | }
122 | foreach ($result as $r) {
123 | $this->syncStorage($r);
124 | }
125 | return true;
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/lib/Controller/OauthController.php:
--------------------------------------------------------------------------------
1 |
4 | *
5 | * @copyright Copyright (c) 2017, ownCloud GmbH.
6 | * @license AGPL-3.0
7 | *
8 | * This code is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Affero General Public License, version 3,
10 | * as published by the Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Affero General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Affero General Public License, version 3,
18 | * along with this program. If not, see
19 | *
20 | */
21 |
22 | namespace OCA\Files_external_dropbox\Controller;
23 |
24 |
25 | use OCP\AppFramework\Http\DataResponse;
26 | use OCP\AppFramework\Controller;
27 | use OCP\AppFramework\Http;
28 | use OCP\IL10N;
29 | use OCP\IRequest;
30 |
31 | /**
32 | * Oauth controller for Dropbox
33 | */
34 | class OauthController extends Controller {
35 | /**
36 | * L10N service
37 | *
38 | * @var IL10N
39 | */
40 | protected $l10n;
41 |
42 | /**
43 | * Creates a new storages controller.
44 | *
45 | * @param string $AppName application name
46 | * @param IRequest $request request
47 | * @param IL10N $l10n l10n service
48 | */
49 | public function __construct(
50 | $AppName,
51 | IRequest $request,
52 | IL10N $l10n
53 | ) {
54 | parent::__construct($AppName, $request);
55 | $this->l10n = $l10n;
56 | }
57 |
58 | /**
59 | * Create a storage from its parameters
60 | *
61 | * @param string $client_id
62 | * @param string $client_secret
63 | * @param string $redirect
64 | * @param int $step
65 | * @param string $code
66 | * @return DataResponse
67 | * @NoAdminRequired
68 | */
69 | public function receiveToken(
70 | $client_id,
71 | $client_secret,
72 | $redirect,
73 | $step,
74 | $code
75 | ) {
76 | $clientId = $client_id;
77 | $clientSecret = $client_secret;
78 | if ($clientId !== null && $clientSecret !== null && $redirect !== null) {
79 | $app = new \Kunnu\Dropbox\DropboxApp($clientId, $clientSecret);
80 | $dropbox = new \Kunnu\Dropbox\Dropbox($app);
81 | $authHelper = $dropbox->getAuthHelper();
82 |
83 | if ($step === 1) {
84 | $authUrl = $authHelper->getAuthUrl($redirect);
85 | return new DataResponse([
86 | 'status' => 'success',
87 | 'data' => ['url' => $authUrl]
88 | ]);
89 | } else if ($step === 2 && isset($code)) {
90 | try {
91 | $accessToken = $authHelper->getAccessToken($code, null, $redirect);
92 | return new DataResponse([
93 | 'status' => 'success',
94 | 'data' => ['token' => $accessToken->getToken()]
95 | ]);
96 | } catch (\Exception $ex) {
97 | return new DataResponse([
98 | 'data' => [
99 | 'message' => $this->l10n->t('Step 2 failed. Exception: %s', [$ex->getMessage()])
100 | ]
101 | ], Http::STATUS_UNPROCESSABLE_ENTITY);
102 | }
103 | }
104 | }
105 | return new DataResponse(
106 | ['data' => ['message' => $this->l10n->t('Invalid Request Params!!')]],
107 | Http::STATUS_BAD_REQUEST
108 | );
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/lib/Storage/Adapter.php:
--------------------------------------------------------------------------------
1 |
4 | *
5 | * @copyright Copyright (c) 2017, ownCloud GmbH.
6 | * @license AGPL-3.0
7 | *
8 | * This code is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Affero General Public License, version 3,
10 | * as published by the Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Affero General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Affero General Public License, version 3,
18 | * along with this program. If not, see
19 | *
20 | */
21 |
22 | namespace OCA\Files_external_dropbox\Storage;
23 |
24 | use Kunnu\Dropbox\Models\FolderMetadata;
25 | use HemantMann\Flysystem\Dropbox\Adapter as DropboxAdapter;
26 |
27 | class Adapter extends DropboxAdapter {
28 | protected function normalizeResponse($obj) {
29 | $result = parent::normalizeResponse($obj);
30 |
31 | if ($result['type'] === 'dir') {
32 | $result['timestamp'] = 0;
33 | }
34 | return $result;
35 | }
36 |
37 | public function getModifiedFolders($items) {
38 | $result = [];
39 | foreach ($items as $item) {
40 | if ($item instanceof FolderMetadata) {
41 | $dirname = $item->getPathDisplay();
42 | } else {
43 | $dirname = dirname($item->getPathDisplay());
44 | }
45 | $result[] = $dirname;
46 | }
47 | return array_unique($result);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/lib/Storage/CacheableFlysystemAdapter.php:
--------------------------------------------------------------------------------
1 |
4 | *
5 | * @copyright Copyright (c) 2017, ownCloud GmbH.
6 | * @license AGPL-3.0
7 | *
8 | * This code is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Affero General Public License, version 3,
10 | * as published by the Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Affero General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Affero General Public License, version 3,
18 | * along with this program. If not, see
19 | *
20 | */
21 |
22 | namespace OCA\Files_external_dropbox\Storage;
23 |
24 | use Icewind\Streams\IteratorDirectory;
25 | use League\Flysystem\FileNotFoundException;
26 |
27 | /**
28 | * Generic Cacheable adapter between flysystem adapters and owncloud's storage system
29 | *
30 | * To use: subclass and call $this->buildFlysystem with the flysystem adapter of choice
31 | */
32 | abstract class CacheableFlysystemAdapter extends Flysystem {
33 | /**
34 | * This property is used to check whether the storage is case insensitive or not
35 | * @var boolean
36 | */
37 | protected $isCaseInsensitiveStorage = false;
38 |
39 | /**
40 | * Stores the results in cache for the current request to prevent multiple requests to the API
41 | * @var array
42 | */
43 | protected $cacheContents = [];
44 |
45 | public function clearCache() {
46 | $this->cacheContents = [];
47 | return $this;
48 | }
49 |
50 | /**
51 | * Get the location which will be used as a key in cache
52 | * If Storage is not case sensitive then convert the key to lowercase
53 | * @param string $path Path to file/folder
54 | * @return string
55 | */
56 | public function getCacheLocation($path) {
57 | $location = $this->buildPath($path);
58 | if ($location === '') {
59 | $location = '/';
60 | }
61 | return $location;
62 | }
63 |
64 | public function buildPath($path, $modifyCase = false) {
65 | $location = parent::buildPath($path);
66 | if ($this->isCaseInsensitiveStorage && $modifyCase) {
67 | $location = strtolower($location);
68 | }
69 | return $location;
70 | }
71 |
72 | /**
73 | * Check if Cache Contains the data for given path, if not then get the data
74 | * from flysystem and store it in cache for this request lifetime
75 | * @param string $path Path to file/folder
76 | * @return array|boolean
77 | */
78 | public function getFlysystemMetadata($path, $overRideCache = false) {
79 | $location = $this->getCacheLocation($path);
80 | if (!isset($this->cacheContents[$location]) || $overRideCache) {
81 | try {
82 | $this->cacheContents[$location] = $this->flysystem->getMetadata($location);
83 | } catch (FileNotFoundException $e) {
84 | // do not store this info in cache as it might interfere with Upload process
85 | return false;
86 | }
87 | }
88 | return $this->cacheContents[$location];
89 | }
90 |
91 | /**
92 | * Store the list of files/folders in the cache so that subsequent requests in the
93 | * same request life cycle does not call the flysystem API
94 | * @param array $contents Return value of $this->flysystem->listContents
95 | */
96 | public function updateCache($contents) {
97 | foreach ($contents as $object) {
98 | $path = $this->isCaseInsensitiveStorage ? strtolower($object['path']) : $object['path'];
99 | $this->cacheContents[$path] = $object;
100 | }
101 | }
102 |
103 | /**
104 | * {@inheritdoc}
105 | */
106 | public function opendir($path) {
107 | try {
108 | // we need to preserve case to ensure the parent folder check is correct
109 | $location = $this->buildPath($path, false);
110 | $content = $this->flysystem->listContents($location);
111 | $this->updateCache($content);
112 | } catch (FileNotFoundException $e) {
113 | return false;
114 | }
115 | $names = array_map(function ($object) {
116 | return $object['basename'];
117 | }, $content);
118 | return IteratorDirectory::wrap($names);
119 | }
120 |
121 | /**
122 | * {@inheritdoc}
123 | */
124 | public function fopen($path, $mode) {
125 | switch ($mode) {
126 | case 'r':
127 | case 'rb':
128 | return parent::fopen($path, $mode);
129 |
130 | default:
131 | unset($this->cacheContents[$this->getCacheLocation($path)]);
132 | return parent::fopen($path, $mode);
133 | }
134 | return false;
135 | }
136 |
137 | /**
138 | * {@inheritdoc}
139 | */
140 | public function filesize($path) {
141 | if ($this->is_dir($path)) {
142 | return 0;
143 | } else {
144 | $info = $this->getFlysystemMetadata($path);
145 | return $info['size'];
146 | }
147 | }
148 |
149 | /**
150 | * {@inheritdoc}
151 | */
152 | public function filemtime($path) {
153 | $info = $this->getFlysystemMetadata($path);
154 | return $info['timestamp'];
155 | }
156 |
157 | /**
158 | * {@inheritdoc}
159 | */
160 | public function stat($path) {
161 | $info = $this->getFlysystemMetadata($path);
162 | return [
163 | 'mtime' => $info['timestamp'],
164 | 'size' => $info['size']
165 | ];
166 | }
167 |
168 | /**
169 | * {@inheritdoc}
170 | */
171 | public function filetype($path) {
172 | if ($path === '' or $path === '/' or $path === '.') {
173 | return 'dir';
174 | }
175 | try {
176 | $info = $this->getFlysystemMetadata($path);
177 | } catch (FileNotFoundException $e) {
178 | return false;
179 | }
180 | if ( !empty($info['type']) ) {
181 | return $info['type'];
182 | } else {
183 | return false;
184 | }
185 | }
186 | }
187 |
--------------------------------------------------------------------------------
/lib/Storage/Dropbox.php:
--------------------------------------------------------------------------------
1 |
4 | *
5 | * @copyright Copyright (c) 2017, ownCloud GmbH.
6 | * @license AGPL-3.0
7 | *
8 | * This code is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Affero General Public License, version 3,
10 | * as published by the Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Affero General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Affero General Public License, version 3,
18 | * along with this program. If not, see
19 | *
20 | */
21 |
22 | namespace OCA\Files_external_dropbox\Storage;
23 |
24 | use Kunnu\Dropbox\DropboxApp;
25 | use Kunnu\Dropbox\Dropbox as DropboxClient;
26 | use OCP\Files\Storage\FlysystemStorageAdapter;
27 |
28 |
29 | class Dropbox extends CacheableFlysystemAdapter {
30 | const APP_NAME = 'files_external_dropbox';
31 |
32 | /**
33 | * @var string
34 | */
35 | protected $clientId;
36 |
37 | /**
38 | * @var string
39 | */
40 | protected $clientSecret;
41 |
42 | /**
43 | * @var string
44 | */
45 | protected $accessToken;
46 |
47 | /**
48 | * @var Adapter
49 | */
50 | protected $adapter;
51 |
52 | /**
53 | * This property is used to check whether the storage is case insensitive or not
54 | * @var boolean
55 | */
56 | protected $isCaseInsensitiveStorage = true;
57 |
58 | /**
59 | * @var Adapter
60 | */
61 | protected $flysystem;
62 |
63 | /**
64 | * Logger variable
65 | * @var \OCP\ILogger
66 | */
67 | protected $logger;
68 |
69 | protected $cacheFilemtime = [];
70 |
71 | /**
72 | * Initialize the storage backend with a flyssytem adapter
73 | * @override
74 | * @param \League\Flysystem\Filesystem $fs
75 | */
76 | public function setFlysystem($fs) {
77 | $this->flysystem = $fs;
78 | $this->flysystem->addPlugin(new \League\Flysystem\Plugin\GetWithMetadata());
79 | }
80 |
81 | public function setAdapter($adapter) {
82 | $this->adapter = $adapter;
83 | }
84 |
85 | /**
86 | * Dropbox constructor.
87 | * @throws \Exception
88 | */
89 | public function __construct($params) {
90 | if (isset($params['client_id']) && isset($params['client_secret']) && isset($params['token'])
91 | && isset($params['configured']) && $params['configured'] === 'true'
92 | ) {
93 | $this->clientId = $params['client_id'];
94 | $this->clientSecret = $params['client_secret'];
95 | $this->accessToken = $params['token'];
96 | $this->root = isset($params['root']) ? $params['root'] : '/';
97 |
98 | $app = new DropboxApp($this->clientId, $this->clientSecret, $this->accessToken);
99 | $dropboxClient = new DropboxClient($app);
100 |
101 | $this->adapter = new Adapter($dropboxClient);
102 | $this->buildFlySystem($this->adapter);
103 | } else {
104 | throw new \Exception('Creating \OCA\Files_external_dropbox\Storage\Dropbox storage failed');
105 | }
106 | $this->logger = \OC::$server->getLogger();
107 | }
108 |
109 | /**
110 | * @return string
111 | */
112 | public function getId() {
113 | return 'dropbox_external::' . $this->clientId . '/' . $this->accessToken;
114 | }
115 |
116 | public function file_exists($path) {
117 | if ($path === '' || $path === '/' || $path === '.') {
118 | return true;
119 | }
120 | return parent::file_exists($path);
121 | }
122 |
123 | protected function getLargest($arr, $default = 0) {
124 | if (count($arr) === 0) {
125 | return $default;
126 | }
127 | arsort($arr);
128 | return array_values($arr)[0];
129 | }
130 |
131 | public function filemtime($path) {
132 | if ($this->is_dir($path)) {
133 | if ($path === '.' || $path === '') {
134 | $path = "/";
135 | }
136 |
137 | if ($this->cacheFilemtime && isset($this->cacheFilemtime[$path])) {
138 | return $this->cacheFilemtime[$path];
139 | }
140 |
141 | $arr = [];
142 | $contents = $this->flysystem->listContents($path, true);
143 | foreach ($contents as $c) {
144 | $arr[] = $c['type'] === 'file' ? $c['timestamp'] : 0;
145 | }
146 | $mtime = $this->getLargest($arr);
147 | } else {
148 | if ($this->cacheFilemtime && isset($this->cacheFilemtime[$path])) {
149 | return $this->cacheFilemtime[$path];
150 | }
151 | $mtime = parent::filemtime($path);
152 | }
153 | $this->cacheFilemtime[$path] = $mtime;
154 | return $mtime;
155 | }
156 |
157 | public function stat($path) {
158 | if ($path === '' || $path === '/' || $path === '.') {
159 | return ['mtime' => 0];
160 | }
161 | return parent::stat($path);
162 | }
163 |
164 | public function getLatestCursor($path = '') {
165 | try {
166 | $dropbox = $this->adapter->getClient();
167 | $resp = $dropbox->postToAPI('/files/list_folder/get_latest_cursor', ['path' => $path, 'recursive' => true, 'include_deleted' => true]);
168 | $body = $resp->getDecodedBody();
169 | if ($body) {
170 | return $body['cursor'];
171 | }
172 | } catch (\Exception $e) {
173 | $this->logger->logException($e, ['app' => self::APP_NAME]);
174 | }
175 | return null;
176 | }
177 |
178 | public function isStorageUpdated($cursor) {
179 | try {
180 | $client = new \GuzzleHttp\Client();
181 | $params = ['cursor' => $cursor, 'timeout' => 30];
182 | $response = $client->post('https://notify.dropboxapi.com/2/files/list_folder/longpoll', ['json' => $params]);
183 | $body = json_decode($response->getBody(), true);
184 |
185 | if ($body && isset($body['changes'])) {
186 | return $body['changes'];
187 | }
188 | } catch (\Exception $e) {
189 | $this->logger->logException($e, ['app' => self::APP_NAME]);
190 | }
191 | return true;
192 | }
193 |
194 | public function getModifiedPaths($cursor) {
195 | $dropbox = $this->adapter->getClient();
196 | $listFolderContinue = $dropbox->listFolderContinue($cursor);
197 | $items = $listFolderContinue->getItems();
198 |
199 | return $this->adapter->getModifiedFolders($items);
200 | }
201 |
202 | /**
203 | * {@inheritDoc}
204 | */
205 | public function test() {
206 | try {
207 | $obj = $this->adapter->getClient()->getCurrentAccount();
208 | if ($obj && $obj->getAccountId()) {
209 | return true;
210 | }
211 | } catch (\Exception $e) {
212 | $this->logger->logException($e, ['app' => self::APP_NAME]);
213 | }
214 |
215 | return false;
216 | }
217 | }
218 |
--------------------------------------------------------------------------------
/lib/Storage/Flysystem.php:
--------------------------------------------------------------------------------
1 |
6 | * @author Robin Appelman
7 | * @author Roeland Jago Douma
8 | * @author Tigran Mkrtchyan
9 | *
10 | * @license AGPL-3.0
11 | *
12 | * This code is free software: you can redistribute it and/or modify
13 | * it under the terms of the GNU Affero General Public License, version 3,
14 | * as published by the Free Software Foundation.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU Affero General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU Affero General Public License, version 3,
22 | * along with this program. If not, see
23 | *
24 | */
25 | namespace OCA\Files_external_dropbox\Storage;
26 |
27 | use Icewind\Streams\CallbackWrapper;
28 | use Icewind\Streams\IteratorDirectory;
29 | use League\Flysystem\AdapterInterface;
30 | use League\Flysystem\FileNotFoundException;
31 | use League\Flysystem\Filesystem;
32 | use League\Flysystem\Plugin\GetWithMetadata;
33 | use OC\Files\Storage\Common;
34 |
35 |
36 | /**
37 | * Generic adapter between flysystem adapters and owncloud's storage system
38 | *
39 | * To use: subclass and call $this->buildFlysystem with the flysystem adapter of choice
40 | */
41 | abstract class Flysystem extends Common {
42 | /**
43 | * @var Filesystem
44 | */
45 | protected $flysystem;
46 |
47 | /**
48 | * @var string
49 | */
50 | protected $root = '';
51 |
52 | /**
53 | * Initialize the storage backend with a flyssytem adapter
54 | *
55 | * @param \League\Flysystem\AdapterInterface $adapter
56 | */
57 | protected function buildFlySystem(AdapterInterface $adapter) {
58 | $this->flysystem = new Filesystem($adapter);
59 | $this->flysystem->addPlugin(new GetWithMetadata());
60 | }
61 |
62 | protected function buildPath($path) {
63 | $fullPath = \OC\Files\Filesystem::normalizePath($this->root . '/' . $path);
64 | return ltrim($fullPath, '/');
65 | }
66 |
67 | /**
68 | * {@inheritdoc}
69 | */
70 | public function file_get_contents($path) {
71 | return $this->flysystem->read($this->buildPath($path));
72 | }
73 |
74 | /**
75 | * {@inheritdoc}
76 | */
77 | public function file_put_contents($path, $data) {
78 | $result = $this->flysystem->put($this->buildPath($path), $data);
79 | if ($result === true) {
80 | return strlen($data);
81 | }
82 | return $result;
83 | }
84 |
85 | /**
86 | * {@inheritdoc}
87 | */
88 | public function file_exists($path) {
89 | return $this->flysystem->has($this->buildPath($path));
90 | }
91 |
92 | /**
93 | * {@inheritdoc}
94 | */
95 | public function unlink($path) {
96 | if ($this->is_dir($path)) {
97 | return $this->rmdir($path);
98 | }
99 | try {
100 | return $this->flysystem->delete($this->buildPath($path));
101 | } catch (FileNotFoundException $e) {
102 | return false;
103 | }
104 | }
105 |
106 | /**
107 | * {@inheritdoc}
108 | */
109 | public function rename($source, $target) {
110 | if ($this->file_exists($target)) {
111 | $this->unlink($target);
112 | }
113 | return $this->flysystem->rename($this->buildPath($source), $this->buildPath($target));
114 | }
115 |
116 | /**
117 | * {@inheritdoc}
118 | */
119 | public function copy($source, $target) {
120 | if ($this->file_exists($target)) {
121 | $this->unlink($target);
122 | }
123 | return $this->flysystem->copy($this->buildPath($source), $this->buildPath($target));
124 | }
125 |
126 | /**
127 | * {@inheritdoc}
128 | */
129 | public function filesize($path) {
130 | if ($this->is_dir($path)) {
131 | return 0;
132 | } else {
133 | return $this->flysystem->getSize($this->buildPath($path));
134 | }
135 | }
136 |
137 | /**
138 | * {@inheritdoc}
139 | */
140 | public function mkdir($path) {
141 | if ($this->file_exists($path)) {
142 | return false;
143 | }
144 | return $this->flysystem->createDir($this->buildPath($path));
145 | }
146 |
147 | /**
148 | * {@inheritdoc}
149 | */
150 | public function filemtime($path) {
151 | return $this->flysystem->getTimestamp($this->buildPath($path));
152 | }
153 |
154 | /**
155 | * {@inheritdoc}
156 | */
157 | public function rmdir($path) {
158 | try {
159 | return @$this->flysystem->deleteDir($this->buildPath($path));
160 | } catch (FileNotFoundException $e) {
161 | return false;
162 | }
163 | }
164 |
165 | /**
166 | * {@inheritdoc}
167 | */
168 | public function opendir($path) {
169 | try {
170 | $content = $this->flysystem->listContents($this->buildPath($path));
171 | } catch (FileNotFoundException $e) {
172 | return false;
173 | }
174 | $names = array_map(function ($object) {
175 | return $object['basename'];
176 | }, $content);
177 | return IteratorDirectory::wrap($names);
178 | }
179 |
180 | /**
181 | * {@inheritdoc}
182 | */
183 | public function fopen($path, $mode) {
184 | $fullPath = $this->buildPath($path);
185 | $useExisting = true;
186 | switch ($mode) {
187 | case 'r':
188 | case 'rb':
189 | try {
190 | return $this->flysystem->readStream($fullPath);
191 | } catch (FileNotFoundException $e) {
192 | return false;
193 | }
194 | case 'w':
195 | case 'w+':
196 | case 'wb':
197 | case 'wb+':
198 | $useExisting = false;
199 | // no break
200 | case 'a':
201 | case 'ab':
202 | case 'r+':
203 | case 'a+':
204 | case 'x':
205 | case 'x+':
206 | case 'c':
207 | case 'c+':
208 | //emulate these
209 | if ($useExisting and $this->file_exists($path)) {
210 | if (!$this->isUpdatable($path)) {
211 | return false;
212 | }
213 | $tmpFile = $this->getCachedFile($path);
214 | } else {
215 | if (!$this->isCreatable(dirname($path))) {
216 | return false;
217 | }
218 | $tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
219 | }
220 | $source = fopen($tmpFile, $mode);
221 | return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath) {
222 | $this->flysystem->putStream($fullPath, fopen($tmpFile, 'r'));
223 | unlink($tmpFile);
224 | });
225 | }
226 | return false;
227 | }
228 |
229 | /**
230 | * {@inheritdoc}
231 | */
232 | public function touch($path, $mtime = null) {
233 | if ($this->file_exists($path)) {
234 | return false;
235 | } else {
236 | $this->file_put_contents($path, '');
237 | return true;
238 | }
239 | }
240 |
241 | /**
242 | * {@inheritdoc}
243 | */
244 | public function stat($path) {
245 | $info = $this->flysystem->getWithMetadata($this->buildPath($path), ['timestamp', 'size']);
246 | return [
247 | 'mtime' => $info['timestamp'],
248 | 'size' => $info['size']
249 | ];
250 | }
251 |
252 | /**
253 | * {@inheritdoc}
254 | */
255 | public function filetype($path) {
256 | if ($path === '' or $path === '/' or $path === '.') {
257 | return 'dir';
258 | }
259 | try {
260 | $info = $this->flysystem->getMetadata($this->buildPath($path));
261 | } catch (FileNotFoundException $e) {
262 | return false;
263 | }
264 | return $info['type'];
265 | }
266 | }
267 |
268 |
--------------------------------------------------------------------------------
/screenshots/LICENCE:
--------------------------------------------------------------------------------
1 | "screenshots-app-external-storage-dropbox.jpg" is taken from https://github.com/owncloud/screenshots under the cc-by 4.0 licence
2 |
--------------------------------------------------------------------------------
/screenshots/screenshots-app-external-storage-dropbox.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJaeger/files_external_dropbox/f6c1c6c1ef3e39e91ece59efc170fd8f95a87882/screenshots/screenshots-app-external-storage-dropbox.jpg
--------------------------------------------------------------------------------
/screenshots/settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJaeger/files_external_dropbox/f6c1c6c1ef3e39e91ece59efc170fd8f95a87882/screenshots/settings.png
--------------------------------------------------------------------------------
/tests/bootstrap.php:
--------------------------------------------------------------------------------
1 | addPsr4('Test\\', OC::$SERVERROOT . '/tests/lib/', true);
8 | \OC::$composerAutoloader->addPsr4('Tests\\', OC::$SERVERROOT . '/tests/', true);
9 |
10 | if (!class_exists('PHPUnit_Framework_TestCase')) {
11 | require_once('PHPUnit/Autoload.php');
12 | }
13 |
14 | OC_Hook::clear();
15 |
--------------------------------------------------------------------------------
/tests/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "client_id": "Client ID",
3 | "client_secret": "Client Secret",
4 | "token": "Token",
5 | "configured": "true"
6 | }
--------------------------------------------------------------------------------
/tests/dropbox.php:
--------------------------------------------------------------------------------
1 |
4 | *
5 | * @copyright Copyright (c) 2017, ownCloud GmbH.
6 | * @license AGPL-3.0
7 | *
8 | * This code is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Affero General Public License, version 3,
10 | * as published by the Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Affero General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Affero General Public License, version 3,
18 | * along with this program. If not, see
19 | *
20 | */
21 |
22 | namespace Test\Files_external_dropbox;
23 |
24 | use Prophecy\Argument;
25 | use Test\Files\Storage\Storage;
26 | use Kunnu\Dropbox\Models\Account as AccountModel;
27 |
28 | class Dropbox extends Storage {
29 | private $config;
30 |
31 | protected function setUp() {
32 | $this->config = json_decode(file_get_contents('./config.json'), true);
33 | $this->instance = new \OCA\Files_external_dropbox\Storage\Dropbox($this->config);
34 | parent::setUp();
35 | }
36 |
37 | public function directoryProvider() {
38 | return [
39 | ['folder'],
40 | [' folder'],
41 | ['folder with space'],
42 | ['spéciäl földer'],
43 | ['test single\'quote'],
44 | ];
45 | }
46 |
47 | /**
48 | * @dataProvider directoryProvider
49 | */
50 | public function testDirectories($directory) {
51 | $this->assertFalse($this->instance->file_exists('/' . $directory));
52 |
53 | $this->assertTrue($this->instance->mkdir('/' . $directory));
54 |
55 | $this->assertTrue($this->instance->file_exists('/' . $directory));
56 | $this->assertTrue($this->instance->is_dir('/' . $directory));
57 | $this->assertFalse($this->instance->is_file('/' . $directory));
58 | $this->assertEquals('dir', $this->instance->filetype('/' . $directory));
59 | $this->assertEquals(0, $this->instance->filesize('/' . $directory));
60 | $this->assertTrue($this->instance->isReadable('/' . $directory));
61 | $this->assertTrue($this->instance->isUpdatable('/' . $directory));
62 |
63 | $this->assertFalse($this->instance->mkdir('/' . $directory)); //can't create existing folders
64 | $this->assertTrue($this->instance->rmdir('/' . $directory));
65 |
66 | $this->wait();
67 | $this->assertFalse($this->instance->file_exists('/' . $directory));
68 |
69 | $this->assertFalse($this->instance->rmdir('/' . $directory)); //can't remove non existing folders
70 | }
71 |
72 | public function testCheckUpdate() {
73 | $this->assertTrue(true);
74 | }
75 |
76 | public function testStat() {
77 | $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
78 | $ctimeStart = time();
79 | $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile));
80 | $this->assertTrue($this->instance->isReadable('/lorem.txt'));
81 | $ctimeEnd = time();
82 | $mTime = $this->instance->filemtime('/lorem.txt');
83 | $this->assertTrue($this->instance->hasUpdated('/lorem.txt', $ctimeStart - 5));
84 | $this->assertTrue($this->instance->hasUpdated('/', $ctimeStart - 5));
85 |
86 | // check that ($ctimeStart - 5) <= $mTime <= ($ctimeEnd + 1)
87 | $this->assertGreaterThanOrEqual(($ctimeStart - 5), $mTime);
88 | $this->assertLessThanOrEqual(($ctimeEnd + 1), $mTime);
89 | $this->assertEquals(filesize($textFile), $this->instance->filesize('/lorem.txt'));
90 |
91 | $stat = $this->instance->stat('/lorem.txt');
92 | //only size and mtime are required in the result
93 | $this->assertEquals($stat['size'], $this->instance->filesize('/lorem.txt'));
94 | $this->assertEquals($stat['mtime'], $mTime);
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/tests/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 | .
12 |
13 |
14 |
15 |
16 | ../../files_external_dropbox
17 |
18 | ../../files_external_dropbox/tests
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------