|
36 | 36 | use OCP\IRequest; |
37 | 37 | use OCP\IUserSession; |
38 | 38 | use OCP\Mail\IMailer; |
| 39 | +use OCP\IURLGenerator; |
39 | 40 |
|
40 | 41 | class ViewController extends Controller { |
41 | 42 |
|
| 43 | + /** |
| 44 | + * @var IURLGenerator |
| 45 | + */ |
| 46 | + private $urlGenerator; |
| 47 | + |
42 | 48 | /** |
43 | 49 | * @var IConfig |
44 | 50 | */ |
@@ -72,15 +78,17 @@ class ViewController extends Controller { |
72 | 78 | * @param IMailer $mailer |
73 | 79 | * @param L10N $l10N |
74 | 80 | * @param Defaults $defaults |
| 81 | + * @param IURLGenerator $urlGenerator |
75 | 82 | */ |
76 | 83 | public function __construct($appName, IRequest $request, |
77 | | - IUserSession $userSession, IConfig $config, IMailer $mailer, L10N $l10N, Defaults $defaults) { |
| 84 | + IUserSession $userSession, IConfig $config, IMailer $mailer, L10N $l10N, Defaults $defaults, IURLGenerator $urlGenerator) { |
78 | 85 | parent::__construct($appName, $request); |
79 | 86 | $this->config = $config; |
80 | 87 | $this->userSession = $userSession; |
81 | 88 | $this->mailer = $mailer; |
82 | 89 | $this->l10n = $l10N; |
83 | 90 | $this->defaults = $defaults; |
| 91 | + $this->urlGenerator = $urlGenerator; |
84 | 92 | } |
85 | 93 |
|
86 | 94 | /** |
@@ -110,9 +118,9 @@ public function index() { |
110 | 118 | $skipPopover = $this->config->getUserValue($userId, $this->appName, 'skipPopover', 'no'); |
111 | 119 | $weekNumbers = $this->config->getUserValue($userId, $this->appName, 'showWeekNr', 'no'); |
112 | 120 | $defaultColor = $this->config->getAppValue('theming', 'color', '#0082C9'); |
113 | | - |
114 | | - $webCalWorkaround = $runningOnNextcloud10OrLater ? 'no' : 'yes'; |
115 | 121 |
|
| 122 | + $webCalWorkaround = $runningOnNextcloud10OrLater ? 'no' : 'yes'; |
| 123 | + |
116 | 124 | return new TemplateResponse('calendar', 'main', [ |
117 | 125 | 'appVersion' => $appVersion, |
118 | 126 | 'defaultView' => $defaultView, |
@@ -152,6 +160,8 @@ public function publicIndex() { |
152 | 160 | 'emailAddress' => '', |
153 | 161 | 'supportsClass' => $supportsClass, |
154 | 162 | 'isPublic' => true, |
| 163 | + 'shareURL' => $this->request->getServerProtocol() . '://' . $this->request->getServerHost() . $this->request->getRequestUri(), |
| 164 | + 'previewImage' => $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'favicon-touch.png')), |
155 | 165 | ], 'public'); |
156 | 166 | $response->addHeader('X-Frame-Options', 'ALLOW'); |
157 | 167 | $csp = new ContentSecurityPolicy(); |
|
0 commit comments