Commit Graph

164 Commits

Author SHA1 Message Date
Roeland Jago Douma 34b86edc34
Check if the cached js file exists
Fixes #8705

If the file does not exist (for whatever reason). It is never cached. No
matter what the depscache etc tell you.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-07 12:55:05 +01:00
Morris Jobke 7bc3c2e057
Merge pull request #7363 from nextcloud/default-share-perms
Let the admin configure the default share permissions
2018-02-27 13:44:34 +01:00
Bjoern Schiessle 7d0102bf73
expose capabilities in js
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-02-27 12:29:25 +01:00
Julius Härtl e5df804834
Expose parameters as variables to templates
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2018-02-27 12:25:52 +01:00
Julius Härtl b87e5a0f2e
Move depsCache clearing to SCSSCacher/JSCombiner
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2018-02-03 15:21:51 +01:00
Julius Härtl 7381a81d30
Add repair step to clear frontend related caches
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2018-02-03 15:21:51 +01:00
Morris Jobke 4fcdfbf5de
Merge pull request #8078 from nextcloud/theming-validate-scss
SCSS hardening
2018-01-29 16:12:10 +01:00
Morris Jobke a661f043e1
Remove unneeded semicolon and parentheses
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 23:46:40 +01:00
Julius Härtl e4c58fc473
Add typehinting an fix some minor cleanup
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2018-01-26 20:11:37 +01:00
Julius Härtl 6770213649
Do not rewrite absolute URLs
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2018-01-26 19:08:45 +01:00
Julius Härtl 68db09ddce
Clear injectect variables when resetting the cache
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2018-01-26 19:07:30 +01:00
Julius Härtl 5eae4819bf
Make sure that injected variables do not break the CSS generation
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2018-01-26 17:03:22 +01:00
Julius Härtl 92e93704be
SCSS files are only cached if their size is > 0
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2018-01-26 17:02:54 +01:00
Morris Jobke 6bbea33133
Simplify ternary operator statements
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 12:36:25 +01:00
Morris Jobke c1e4f9f305
Use type casting instead of *val() method
It should be up to 6x faster

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 11:35:42 +01:00
Abijeet de5467811a Fixes password input being prompted every time.
Fixes #7106

- Echoing the current server time via a JS variable and storing the current time on page load in JS.
- Calculating the diff and taking it into account when deciding whether to show the password confirmation.

Signed-off-by: Abijeet <abijeetpatro@gmail.com>
2018-01-08 23:47:52 +05:30
Bjoern Schiessle 1bcbeb24bc
disable password confirmation with SSO
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-01-02 20:30:37 +01:00
John Molakvoæ (skjnldsv) c0c4443ffc
Fixed tests
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-12-30 05:55:45 +01:00
John Molakvoæ (skjnldsv) 02bfc867ef
Added tests for various installations types
- With root installation
 - Core css
 - App inside server root
 - Secondary apps directory outside server root
- With an installation in a sub directory
 - Core css
 - App inside server root
 - Secondary apps directory outside server root

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-12-30 05:55:45 +01:00
John Molakvoæ (skjnldsv) 88b72fd027
Fixup! getWebdir return
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-12-30 05:55:45 +01:00
John Molakvoæ (skjnldsv) dc938628f7
Use OC_Util function for app web path
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-12-30 05:55:44 +01:00
John Molakvoæ (skjnldsv) ad20af619f
getWebDir function
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-12-30 05:55:44 +01:00
John Molakvoæ (skjnldsv) 89ca9cb35c
Fixed webroot for scss files
Fixed tests

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-12-30 05:55:44 +01:00
John Molakvoæ (skjnldsv) fb6c5cc416
Fixed scss url rewriting
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-12-30 05:55:43 +01:00
Julius Härtl 4c3eb80a91
Hide delete button if the avatar is a generated one
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2017-12-19 18:49:26 +01:00
John Molakvoæ (skjnldsv) f2d5927ea3
Reduce length of md5 in scss caching
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-12-14 11:11:54 +01:00
Morris Jobke ab0a3fbbbc
Merge pull request #7061 from kyrofa/bugfix/6028/app_path_realpath
{J,CS}SResourceLocator: account for symlinks in app path
2017-11-14 13:58:02 +01:00
Kyle Fazzari d2a2793073
JSResourceLocator: re-use $app_path
Signed-off-by: Kyle Fazzari <kyrofa@ubuntu.com>
2017-11-12 08:08:38 -08:00
Roeland Jago Douma 448fa4f59e
If for some reason the json can't be decoded it is not cached
Should fix #6898

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-11-08 12:37:35 +01:00
Kyle Fazzari 06ba1a8a02
JSResourceLocator: account for symlinks in app path
Signed-off-by: Kyle Fazzari <kyrofa@ubuntu.com>
2017-11-07 14:54:21 -08:00
Morris Jobke 0eebff152a
Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 16:56:19 +01:00
Kyle Fazzari b0d296639c
CSSResourceLocator: account for symlinks in app path
Currently, if the app path includes a symlink, the calculated webDir
will be incorrect when generating CSS and URLs will be pointing to the
wrong place, breaking CSS.

Use realpath when retrieving app path, and these issues go away.

Fix #6028

Signed-off-by: Kyle Fazzari <kyrofa@ubuntu.com>
2017-11-03 23:52:09 -07:00
John Molakvoæ (skjnldsv) dec713fc92
Do not stop on scss compilation failure
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-09-26 15:29:37 +02:00
John Molakvoæ (skjnldsv) 4a5eeb2ce7
Fixed webroot detection
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-09-22 07:20:31 +02:00
Robin Appelman 5430d73a0e
Fix "webroot not found" when installed to the root of the webserver
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-09-20 14:19:15 +02:00
John Molakvoæ (skjnldsv) 1a0ac912b2
Fix webroot throw
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-09-14 08:41:10 +02:00
Axel Helmert 01d4967130 Fix undefined variable $tmpRoot
Refactoring of webroot detection left an unused variable.

Fixes: #6415
Signed-off-by: Axel Helmert <info@luka.de>
2017-09-12 12:14:27 +02:00
tux-rampage 7a33b9273e Refactor webroot detection in resource locator
The current implementation breaks installations with symlinks to
directories inside the webroot (i.E. apps).

With this change both variants, directory and symlinks, will be detected
correctly.

Fixes: #6028
Signed-off-by: Axel Helmert <axel.helmert@luka.de>
2017-09-06 21:32:48 +02:00
Julius Härtl b09ce70117
Rebuild SCSS files if frontend controller value changes
fixes #6271
2017-09-03 17:32:41 +02:00
Morris Jobke f640b56bfa Cleanup unused methods
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-08-15 10:09:47 +02:00
Morris Jobke 585e5c6ea5
Logo claim is not used anymore
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-08-02 23:08:45 +02:00
Morris Jobke 2ebafb06fd Properly handle if the deps file if for some reason empty
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-07-19 00:10:46 +02:00
Morris Jobke 6a1c4990ab Merge pull request #5252 from derkostka/master
Use realpath to obtain the webroot.
2017-06-21 17:25:12 -05:00
Sebastian Kostka c7ce42e45b Squashed the webroot fix
Signed-off-by: Sebastian Kostka <sebastian.kostka@gmail.com>
2017-06-20 22:15:20 +02:00
Julius Härtl 517dfdda0d
Fix theming app to also use the prefix
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2017-06-16 10:51:37 +02:00
Julius Härtl 0789adaf95
Make cache and scss caching depend on the baseUrl
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2017-06-15 12:46:24 +02:00
Roeland Jago Douma 32f5c028a0
Set SCSS dependencies to memcache on compile
Else when an upgrade happens we will recompile all the SCSS files all
the time (until the cache expires).

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-05-21 22:10:00 +02:00
Joas Schilling 4792867357
Stop infinit loop on invalid settings css/js file
Don't try to find dirname of false...

Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-05-19 11:41:08 +02:00
Roeland Jago Douma 6afd098a94
Cache deps list to memcache on write not on first read
Fixes #4886

Caching on first read leads to the bug that if the files are updated we
will never cache again. Since we will always fetch from the memcache
(which works) and then see that the files are newer.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-05-16 09:01:20 +02:00
Julius Haertl 68a63ad3f3
Implement scss variable injection by OC_Defaults
Signed-off-by: Julius Haertl <jus@bitgrid.net>

Add Scss variables to example theme and theming app

Signed-off-by: Julius Haertl <jus@bitgrid.net>

Use SCSSCacher to build theming css

Signed-off-by: Julius Härtl <jus@bitgrid.net>

Update theming.scss

Signed-off-by: Julius Härtl <jus@bitgrid.net>

Code cleanup

Signed-off-by: Julius Härtl <jus@bitgrid.net>

Fix tests

Signed-off-by: Julius Härtl <jus@bitgrid.net>

Inject SCSSCacher for easier testing

Signed-off-by: Julius Härtl <jus@bitgrid.net>

Fix typehint

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>

Generate absolute URLs

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>

Fix tests to always use absolute urls for theming images

Signed-off-by: Julius Härtl <jus@bitgrid.net>

MailheaderColor -> ColorPrimary

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-04-25 11:39:45 +02:00
Morris Jobke c54a59d51e
Remove unused use statements
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-04-22 19:23:31 -05:00
Morris Jobke 5b4adf66e5
Move OC_Defaults to OCP\Defaults
* currently there are two ways to access default values:
  OCP\Defaults or OC_Defaults (which is extended by
  OCA\Theming\ThemingDefaults)
* our code used a mixture of both of them, which made
  it hard to work on theme values
* this extended the public interface with the missing
  methods and uses them everywhere to only rely on the
  public interface

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-04-09 21:43:01 -05:00
Roeland Jago Douma efb21a948e Merge pull request #4093 from nextcloud/endorse-password-protection
Endorse password protection
2017-04-04 11:04:21 +02:00
Christoph Wurst cbe44043be Merge pull request #4131 from nextcloud/fix-jscombiner
Fix check for cache value in JSCombiner
2017-04-03 11:27:39 +02:00
Bjoern Schiessle b85b6f2439
feature endorse password for share links
works like "enforce password protection", but let the
user optionally remove the password protection after the
password is set. by Timo Benk

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2017-04-03 10:57:52 +02:00
Morris Jobke 9813023aab
Fix gzip files for Safari
* Safari support gzip only if the filename does not
  end on .gz - so this renames them to .gzip

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-29 00:11:51 -06:00
Morris Jobke 51e5c0766c
Fix check for cache value in JSCombiner
* fixes following log output, because there was empty string
  stored in the cache

Invalid argument supplied for foreach() at lib/private/Template/JSCombiner.php#108

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-28 17:43:39 -06:00
Roeland Jago Douma a40405531c
Fix tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-28 23:13:59 +02:00
Roeland Jago Douma 54f9b35f71
Allow to gzip CSS/JS files
Since in production the SCSS files are compiled once and the javascript
files are combined once we can just as well gzip them aggresively.

This means that once they are requested and the browser supports gzip we
can just serve the gzipped file saving precious bandwidth.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-28 21:46:23 +02:00
Lukas Reschke d81cdcbe88
Don't run JSCombiner when not installed
When the instance is not installed don't run the JSCombiner as the appdata folder does not yet exist.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2017-03-25 15:25:06 +01:00
Roeland Jago Douma b5299b1403
Add return
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-24 10:58:11 +01:00
Roeland Jago Douma 90910290d1
Add debug mode
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-24 10:58:11 +01:00
Roeland Jago Douma 242f8964cf
Add caching
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-24 10:58:11 +01:00
Roeland Jago Douma 8e89ad21a2
[PoC] JS Combiner
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-24 10:58:10 +01:00
Roeland Jago Douma e3925ba2a1
Cache SCSS dependency file in memcache
Since reading a file from disks can be costly. Lets store the dependency
json also in memcache.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-22 20:14:08 +01:00
Julius Härtl 29ec58f1b5
Add tests for SCSSCacher
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2017-03-20 14:12:35 +01:00
Julius Haertl 4fbf9a4feb
Add tests for SCSSCacher
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2017-03-20 12:49:08 +01:00
Julius Haertl 2bd06e0d37
Add variables.scss and import it for each scss file
Signed-off-by: Julius Haertl <jus@bitgrid.net>
2017-03-20 12:49:05 +01:00
Lukas Reschke ac1aff7d92 Merge pull request #3950 from nextcloud/downstream-27149
Forbid to upload part files via web UI
2017-03-20 11:44:57 +01:00
Felix Heidecke 11f838f9e4
Add ignore_files to config,
test files against ignore_files list on upload

fix typo and indentation

Move blacklist declaration to lib/public/Files/FileInfo.php,

Rename *ignored to *blacklisted

Mocked blacklist_files for testing

Mocked blacklist_files for testing

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-20 01:17:12 -06:00
Jörn Friedrich Dreyer 6b71dd11b7
log where a resource was not found
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-19 22:21:19 -06:00
Roeland Jago Douma f86b5c2ebb
Properly calculate webdir using the serverroot
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-10 20:00:34 +01:00
Roeland Jago Douma f7ebf1d47d
SCSS files don't exist on the default fs so just add them to the
resource list

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-10 19:13:44 +01:00
Morris Jobke 3ca9d53194
Fix SCSS usage in apps
* fix the web root detection of the ResourceLocator for apps

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-10 14:44:01 +01:00
Roeland Jago Douma 57be594f1f
Allow using import in sass files
This allows us to combine multiple sass files that we have to always
load together anyway.

Fixes #3389

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-09 20:29:50 +01:00
Morris Jobke 8e3d0fecd2
Use intval() for validation of config options
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-02-21 17:22:06 -06:00
Morris Jobke 3284efd199
Improve the UX for sharing settings
* shows a info when list is potentially truncated
* shows a warning when characters length is not enough

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-02-21 17:07:07 -06:00
Morris Jobke 200a28255e
Always enable avatars
* we introduced this setting in the begining because our
  avatar support caused some performance issues, but we
  fixed them and should only provide one way how Nextcloud
  looks

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-02-13 17:53:33 -06:00
Robin Appelman 3d8a300b77
Lower log levels of resource locator
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-02-03 13:09:33 +01:00
John Molakvoæ (skjnldsv) dcad6032b1
Appdata var fix
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-01-24 17:46:20 +01:00
John Molakvoæ (skjnldsv) a440c3e94c
Remove unused webroot
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-01-24 17:27:35 +01:00
John Molakvoæ (skjnldsv) 4ceb2bf84c
Enable every app to generate their scss file
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-01-22 19:33:45 +01:00
John Molakvoæ (skjnldsv) 67467873c2
Removed jquery scss
- Switched to setup.css
- Disable scss when displaying the update page
- Improved setup css
- Fixed loading failure of other styles on setup & update page
- Improved scss compiler with an ignore scss compilation option

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-01-10 11:06:03 +01:00
John Molakvoæ (skjnldsv) 7b8c777b57
Fix css url prefix for IgnoreFrontController enabled configs
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-01-06 09:42:39 +01:00
John Molakvoæ (skjnldsv) 8bcad88c6f
ScssCcacher typo fix
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-01-06 09:42:39 +01:00
John Molakvoæ (skjnldsv) 6d3a890cb3
Camelcase fix
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-01-06 09:42:39 +01:00
Lukas Reschke 7b8debc5d3
Remove webroot from file path
The webroot is already provided, otherwise this links to stuff like "/nextcloud/nextcloud/index.php" instead of "/nextcloud/index.php"

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2017-01-06 09:42:39 +01:00
Roeland Jago Douma 350b7ebc86
Adds CssControllerTests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-01-06 09:42:39 +01:00
John Molakvoæ (skjnldsv) e3a57c1f07
Fix variables should be passed by reference
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-01-06 09:42:39 +01:00
Roeland Jago Douma 203143e26a
Fix typo
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-01-06 09:42:14 +01:00
Roeland Jago Douma 7bd9087f9e
Inject SCSSCacher
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-01-06 09:42:14 +01:00
Roeland Jago Douma d64d661ef5
Make SCCCacher injectable
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-01-06 09:42:14 +01:00
Roeland Jago Douma d9eaed5ffa
Formatting
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-01-06 09:42:14 +01:00
Roeland Jago Douma 2816177ecb
Code cleanup
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-01-06 09:42:13 +01:00
John Molakvoæ (skjnldsv) 1f769e6e76
Fix php docs
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-01-06 09:42:13 +01:00
John Molakvoæ (skjnldsv) 6380d503af
Css cache folder name fix, route fix and various fixes
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-01-06 09:42:13 +01:00
John Molakvoæ (skjnldsv) 35b13b856b
Appdata location fix
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-01-06 09:42:13 +01:00
John Molakvoæ (skjnldsv) 9a21d98824
Regex fix
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-01-06 09:42:13 +01:00
John Molakvoæ (skjnldsv) 3b62003c9c
Injection fix and log appname fix
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-01-06 09:42:13 +01:00
John Molakvoæ (skjnldsv) 6697bae6aa
Url generator fix
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2017-01-06 09:42:13 +01:00