mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
check for site owner instead of crashing on missing current_site
This commit is contained in:
parent
1afb5da0bb
commit
951e66861e
2 changed files with 3 additions and 1 deletions
|
@ -103,7 +103,7 @@ get '/site/:username/stats' do
|
|||
|
||||
stats = stats_dataset.all.reverse
|
||||
|
||||
if params[:format] == 'csv'
|
||||
if current_site && @site.owned_by?(current_site) && params[:format] == 'csv'
|
||||
content_type 'application/csv'
|
||||
attachment "#{current_site.username}-stats.csv"
|
||||
|
||||
|
|
|
@ -166,11 +166,13 @@
|
|||
|
||||
<canvas id="myChart" style="width:100%;height:300px;display:block"></canvas>
|
||||
|
||||
<% if @site == current_site %>
|
||||
<div class="row">
|
||||
<div class="col col-50">
|
||||
<p><a href="?days=<%= params[:days] %>&format=csv">Export as CSV File</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!--
|
||||
<div class="row">
|
||||
|
|
Loading…
Add table
Reference in a new issue