comfy_middle_seat 4.5.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rubyonrails.yml +21 -4
- data/CHANGELOG.md +31 -1
- data/README.md +41 -1
- data/app/assets/javascripts/comfy/admin/cms/diff.js +178 -10
- data/app/assets/stylesheets/comfy/admin/cms/base.sass +88 -0
- data/app/assets/stylesheets/comfy/admin/cms/harbor.sass +4 -0
- data/app/controllers/comfy/admin/cms/snippets_controller.rb +9 -0
- data/app/controllers/comfy/admin/cms/tag_usage_controller.rb +20 -0
- data/app/helpers/comfy/admin/cms/tag_usage_helper.rb +21 -0
- data/app/models/comfy/cms/layout.rb +1 -1
- data/app/views/comfy/admin/cms/revisions/show.html.haml +44 -35
- data/app/views/comfy/admin/cms/snippets/_usage.html.haml +8 -0
- data/app/views/comfy/admin/cms/snippets/edit.html.haml +6 -0
- data/app/views/comfy/admin/cms/snippets/index.html.haml +18 -10
- data/app/views/comfy/admin/cms/tag_usage/_source.html.haml +2 -0
- data/app/views/comfy/admin/cms/tag_usage/index.html.haml +54 -0
- data/app/views/layouts/comfy/admin/cms/_left.html.haml +3 -0
- data/config/initializers/comfy_middle_seat.rb +3 -3
- data/config/locales/ar.yml +23 -0
- data/config/locales/ca.yml +23 -0
- data/config/locales/cs.yml +23 -0
- data/config/locales/da.yml +23 -0
- data/config/locales/de.yml +23 -0
- data/config/locales/en.yml +23 -0
- data/config/locales/es.yml +23 -0
- data/config/locales/fi.yml +23 -0
- data/config/locales/fr.yml +23 -0
- data/config/locales/gr.yml +23 -0
- data/config/locales/hr.yml +23 -0
- data/config/locales/it.yml +23 -0
- data/config/locales/ja.yml +23 -0
- data/config/locales/nb.yml +23 -0
- data/config/locales/nl.yml +23 -0
- data/config/locales/pl.yml +23 -0
- data/config/locales/pt-BR.yml +23 -0
- data/config/locales/ru.yml +23 -0
- data/config/locales/sk.yml +23 -0
- data/config/locales/sv.yml +23 -0
- data/config/locales/tr.yml +23 -0
- data/config/locales/uk.yml +23 -0
- data/config/locales/zh-CN.yml +23 -0
- data/config/locales/zh-TW.yml +23 -0
- data/lib/comfy_middle_seat/configuration.rb +3 -3
- data/lib/comfy_middle_seat/content/snippet_usage.rb +44 -0
- data/lib/comfy_middle_seat/content/tag_usage.rb +129 -0
- data/lib/comfy_middle_seat/content/tag_usage_report.rb +83 -0
- data/lib/comfy_middle_seat/content/tags/helper.rb +1 -1
- data/lib/comfy_middle_seat/content/tags/mixins/file_content.rb +6 -10
- data/lib/comfy_middle_seat/content.rb +3 -0
- data/lib/comfy_middle_seat/routing.rb +1 -0
- data/lib/comfy_middle_seat/version.rb +1 -1
- data/lib/tasks/cms_tag_usage.rake +32 -0
- metadata +10 -1
data/config/locales/nb.yml
CHANGED
|
@@ -65,6 +65,26 @@ nb:
|
|
|
65
65
|
files: Filer
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
tag_usage:
|
|
69
|
+
title: Bruk av tagger
|
|
70
|
+
scope: Alt lagret innhold på dette nettstedet, også upublisert innhold. Ingen rendering under kjøring.
|
|
71
|
+
multisite: Denne rapporten for ett nettsted er ikke uttømmende for globale tillatelseslister på tvers av nettsteder.
|
|
72
|
+
partial: Delvisninger
|
|
73
|
+
helper: Hjelpemetoder
|
|
74
|
+
template: Maler
|
|
75
|
+
name: Navn
|
|
76
|
+
status: Gjeldende status
|
|
77
|
+
sources: Kilder
|
|
78
|
+
used_in: Brukt i
|
|
79
|
+
no_results: Ingen samsvarende tagger funnet.
|
|
80
|
+
incomplete: Rapporten er ufullstendig. Noe innhold kunne ikke analyseres; se advarslene nedenfor.
|
|
81
|
+
warnings: Analyseadvarsler
|
|
82
|
+
config: Foreslått konfigurasjon
|
|
83
|
+
review: Gjennomgå før bruk. Forslaget er ikke automatisk tillatelse eller sikkerhetsgodkjenning. Ingen konfigurasjon er endret.
|
|
84
|
+
explicitly_allowed: Uttrykkelig tillatt
|
|
85
|
+
allowed_by_default: Tillatt som standard
|
|
86
|
+
blocked: Blokkert
|
|
87
|
+
|
|
68
88
|
search:
|
|
69
89
|
submit: Søk
|
|
70
90
|
clear: Tøm
|
|
@@ -210,6 +230,9 @@ nb:
|
|
|
210
230
|
create: Oprett snutt
|
|
211
231
|
cancel: Cancel
|
|
212
232
|
update: Endre snutt
|
|
233
|
+
usage:
|
|
234
|
+
no_references: Fant ingen referanser.
|
|
235
|
+
incomplete: Listen over referanser til snutten kan være ufullstendig.
|
|
213
236
|
|
|
214
237
|
revisions:
|
|
215
238
|
reverted: Innhold tilbakeført
|
data/config/locales/nl.yml
CHANGED
|
@@ -65,6 +65,26 @@ nl:
|
|
|
65
65
|
files: Bestanden
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
tag_usage:
|
|
69
|
+
title: Taggebruik
|
|
70
|
+
scope: Alle opgeslagen inhoud van deze site, ook niet-gepubliceerde inhoud. Geen rendering tijdens uitvoering.
|
|
71
|
+
multisite: Dit rapport voor één site is niet volledig voor globale toelatingslijsten voor meerdere sites.
|
|
72
|
+
partial: Deeltemplates
|
|
73
|
+
helper: Hulpmethoden
|
|
74
|
+
template: Templates
|
|
75
|
+
name: Naam
|
|
76
|
+
status: Huidige status
|
|
77
|
+
sources: Bronnen
|
|
78
|
+
used_in: Gebruikt in
|
|
79
|
+
no_results: Geen overeenkomende tags gevonden.
|
|
80
|
+
incomplete: Onvolledig rapport. Sommige inhoud kon niet worden geanalyseerd; bekijk de onderstaande waarschuwingen.
|
|
81
|
+
warnings: Analysewaarschuwingen
|
|
82
|
+
config: Voorgestelde configuratie
|
|
83
|
+
review: Controleer vóór gebruik. Dit voorstel is geen automatische toestemming of beveiligingsgoedkeuring. Er is geen configuratie gewijzigd.
|
|
84
|
+
explicitly_allowed: Expliciet toegestaan
|
|
85
|
+
allowed_by_default: Standaard toegestaan
|
|
86
|
+
blocked: Geblokkeerd
|
|
87
|
+
|
|
68
88
|
search:
|
|
69
89
|
submit: Zoeken
|
|
70
90
|
clear: Wissen
|
|
@@ -210,6 +230,9 @@ nl:
|
|
|
210
230
|
create: Snippet Aanmaken
|
|
211
231
|
cancel: Annuleren
|
|
212
232
|
update: Snippet Bijwerken
|
|
233
|
+
usage:
|
|
234
|
+
no_references: Geen verwijzingen gevonden.
|
|
235
|
+
incomplete: De lijst met verwijzingen naar het snippet is mogelijk onvolledig.
|
|
213
236
|
|
|
214
237
|
revisions:
|
|
215
238
|
reverted: Content teruggezet
|
data/config/locales/pl.yml
CHANGED
|
@@ -65,6 +65,26 @@ pl:
|
|
|
65
65
|
files: Pliki
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
tag_usage:
|
|
69
|
+
title: Użycie znaczników
|
|
70
|
+
scope: Cała zapisana treść tej witryny, także nieopublikowana. Bez renderowania w czasie wykonania.
|
|
71
|
+
multisite: Ten raport jednej witryny nie jest wyczerpujący dla globalnych list dozwolonych elementów wielu witryn.
|
|
72
|
+
partial: Szablony częściowe
|
|
73
|
+
helper: Metody pomocnicze
|
|
74
|
+
template: Szablony
|
|
75
|
+
name: Nazwa
|
|
76
|
+
status: Aktualny stan
|
|
77
|
+
sources: Źródła
|
|
78
|
+
used_in: Użyto w
|
|
79
|
+
no_results: Nie znaleziono pasujących znaczników.
|
|
80
|
+
incomplete: Raport niekompletny. Nie udało się przeanalizować części treści; sprawdź poniższe ostrzeżenia.
|
|
81
|
+
warnings: Ostrzeżenia analizy
|
|
82
|
+
config: Proponowana konfiguracja
|
|
83
|
+
review: Sprawdź przed użyciem. Propozycja nie oznacza automatycznego zezwolenia ani zatwierdzenia bezpieczeństwa. Konfiguracja nie została zmieniona.
|
|
84
|
+
explicitly_allowed: Jawnie dozwolone
|
|
85
|
+
allowed_by_default: Domyślnie dozwolone
|
|
86
|
+
blocked: Zablokowane
|
|
87
|
+
|
|
68
88
|
search:
|
|
69
89
|
submit: Szukaj
|
|
70
90
|
clear: Wyczyść
|
|
@@ -210,6 +230,9 @@ pl:
|
|
|
210
230
|
create: Utwórz snippet
|
|
211
231
|
cancel: Anuluj
|
|
212
232
|
update: Uaktualnij snippet
|
|
233
|
+
usage:
|
|
234
|
+
no_references: Nie znaleziono odwołań.
|
|
235
|
+
incomplete: Lista odwołań do snippeta może być niepełna.
|
|
213
236
|
|
|
214
237
|
revisions:
|
|
215
238
|
reverted: Zawartość została przywrócona
|
data/config/locales/pt-BR.yml
CHANGED
|
@@ -65,6 +65,26 @@ pt-BR:
|
|
|
65
65
|
files: Arquivos
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
tag_usage:
|
|
69
|
+
title: Uso de tags
|
|
70
|
+
scope: Todo o conteúdo salvo deste site, incluindo o não publicado. Sem renderização em tempo de execução.
|
|
71
|
+
multisite: Este relatório de um único site não é exaustivo para listas globais de permissões de vários sites.
|
|
72
|
+
partial: Parciais
|
|
73
|
+
helper: Helpers
|
|
74
|
+
template: Modelos
|
|
75
|
+
name: Nome
|
|
76
|
+
status: Estado atual
|
|
77
|
+
sources: Fontes
|
|
78
|
+
used_in: Usado em
|
|
79
|
+
no_results: Nenhuma tag correspondente encontrada.
|
|
80
|
+
incomplete: Relatório incompleto. Parte do conteúdo não pôde ser analisada; revise os avisos abaixo.
|
|
81
|
+
warnings: Avisos da análise
|
|
82
|
+
config: Configuração proposta
|
|
83
|
+
review: Revise antes de usar. Esta proposta não é uma permissão automática nem uma aprovação de segurança. Nenhuma configuração foi alterada.
|
|
84
|
+
explicitly_allowed: Permitido explicitamente
|
|
85
|
+
allowed_by_default: Permitido por padrão
|
|
86
|
+
blocked: Bloqueado
|
|
87
|
+
|
|
68
88
|
search:
|
|
69
89
|
submit: Pesquisar
|
|
70
90
|
clear: Limpar
|
|
@@ -210,6 +230,9 @@ pt-BR:
|
|
|
210
230
|
create: Criar Fragmento
|
|
211
231
|
cancel: Cancelar
|
|
212
232
|
update: Atualizar Fragmento
|
|
233
|
+
usage:
|
|
234
|
+
no_references: Nenhuma referência encontrada.
|
|
235
|
+
incomplete: A lista de referências ao fragmento pode estar incompleta.
|
|
213
236
|
|
|
214
237
|
revisions:
|
|
215
238
|
reverted: Conteúdo revertido com sucesso.
|
data/config/locales/ru.yml
CHANGED
|
@@ -65,6 +65,26 @@ ru:
|
|
|
65
65
|
files: Файлы
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
tag_usage:
|
|
69
|
+
title: Использование тегов
|
|
70
|
+
scope: Всё сохранённое содержимое этого сайта, включая неопубликованное. Без рендеринга во время выполнения.
|
|
71
|
+
multisite: Этот отчёт по одному сайту не является полным для глобальных списков разрешений нескольких сайтов.
|
|
72
|
+
partial: Частичные шаблоны
|
|
73
|
+
helper: Вспомогательные методы
|
|
74
|
+
template: Шаблоны
|
|
75
|
+
name: Имя
|
|
76
|
+
status: Текущий статус
|
|
77
|
+
sources: Источники
|
|
78
|
+
used_in: Используется в
|
|
79
|
+
no_results: Соответствующие теги не найдены.
|
|
80
|
+
incomplete: Отчёт неполный. Часть содержимого не удалось проанализировать; проверьте предупреждения ниже.
|
|
81
|
+
warnings: Предупреждения анализа
|
|
82
|
+
config: Предлагаемая конфигурация
|
|
83
|
+
review: Проверьте перед использованием. Предложение не является автоматическим разрешением или подтверждением безопасности. Конфигурация не изменена.
|
|
84
|
+
explicitly_allowed: Явно разрешено
|
|
85
|
+
allowed_by_default: Разрешено по умолчанию
|
|
86
|
+
blocked: Заблокировано
|
|
87
|
+
|
|
68
88
|
search:
|
|
69
89
|
submit: Поиск
|
|
70
90
|
clear: Очистить
|
|
@@ -210,6 +230,9 @@ ru:
|
|
|
210
230
|
create: Создать сниппет
|
|
211
231
|
cancel: Oтменить
|
|
212
232
|
update: Обновить сниппет
|
|
233
|
+
usage:
|
|
234
|
+
no_references: Ссылок не найдено.
|
|
235
|
+
incomplete: Список мест, где используется сниппет, может быть неполным.
|
|
213
236
|
|
|
214
237
|
revisions:
|
|
215
238
|
reverted: Контент возвращен в прежнее состояние
|
data/config/locales/sk.yml
CHANGED
|
@@ -65,6 +65,26 @@ sk:
|
|
|
65
65
|
files: Súbory
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
tag_usage:
|
|
69
|
+
title: Použitie značiek
|
|
70
|
+
scope: Všetok uložený obsah tohto webu vrátane nepublikovaného. Bez vykresľovania počas behu.
|
|
71
|
+
multisite: Tento prehľad jedného webu nie je úplný pre globálne zoznamy povolení viacerých webov.
|
|
72
|
+
partial: Čiastkové šablóny
|
|
73
|
+
helper: Pomocné metódy
|
|
74
|
+
template: Šablóny
|
|
75
|
+
name: Názov
|
|
76
|
+
status: Aktuálny stav
|
|
77
|
+
sources: Zdroje
|
|
78
|
+
used_in: Použité v
|
|
79
|
+
no_results: Nenašli sa žiadne zodpovedajúce značky.
|
|
80
|
+
incomplete: Prehľad nie je úplný. Časť obsahu sa nepodarilo analyzovať; skontrolujte upozornenia nižšie.
|
|
81
|
+
warnings: Upozornenia analýzy
|
|
82
|
+
config: Navrhovaná konfigurácia
|
|
83
|
+
review: Pred použitím skontrolujte. Návrh nie je automatickým povolením ani bezpečnostným schválením. Žiadna konfigurácia nebola zmenená.
|
|
84
|
+
explicitly_allowed: Výslovne povolené
|
|
85
|
+
allowed_by_default: Predvolene povolené
|
|
86
|
+
blocked: Blokované
|
|
87
|
+
|
|
68
88
|
search:
|
|
69
89
|
submit: Hľadať
|
|
70
90
|
clear: Vyčistiť
|
|
@@ -210,6 +230,9 @@ sk:
|
|
|
210
230
|
create: Vytvoriť fragment
|
|
211
231
|
cancel: Zrušiť
|
|
212
232
|
update: Upraviť fragment
|
|
233
|
+
usage:
|
|
234
|
+
no_references: Nenašli sa žiadne odkazy.
|
|
235
|
+
incomplete: Prehľad použitia fragmentu nemusí byť úplný.
|
|
213
236
|
|
|
214
237
|
revisions:
|
|
215
238
|
reverted: Obsah bol obnovený
|
data/config/locales/sv.yml
CHANGED
|
@@ -65,6 +65,26 @@ sv:
|
|
|
65
65
|
files: Filer
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
tag_usage:
|
|
69
|
+
title: Tagganvändning
|
|
70
|
+
scope: Allt sparat innehåll på denna webbplats, även opublicerat innehåll. Ingen rendering vid körning.
|
|
71
|
+
multisite: Denna rapport för en webbplats är inte uttömmande för globala tillåtelselistor för flera webbplatser.
|
|
72
|
+
partial: Delvyer
|
|
73
|
+
helper: Hjälpmetoder
|
|
74
|
+
template: Mallar
|
|
75
|
+
name: Namn
|
|
76
|
+
status: Aktuell status
|
|
77
|
+
sources: Källor
|
|
78
|
+
used_in: Används i
|
|
79
|
+
no_results: Inga matchande taggar hittades.
|
|
80
|
+
incomplete: Rapporten är ofullständig. En del innehåll kunde inte analyseras; granska varningarna nedan.
|
|
81
|
+
warnings: Analysvarningar
|
|
82
|
+
config: Föreslagen konfiguration
|
|
83
|
+
review: Granska före användning. Förslaget är inte ett automatiskt tillstånd eller säkerhetsgodkännande. Ingen konfiguration har ändrats.
|
|
84
|
+
explicitly_allowed: Uttryckligen tillåtet
|
|
85
|
+
allowed_by_default: Tillåtet som standard
|
|
86
|
+
blocked: Blockerat
|
|
87
|
+
|
|
68
88
|
search:
|
|
69
89
|
submit: Sök
|
|
70
90
|
clear: Rensa
|
|
@@ -210,6 +230,9 @@ sv:
|
|
|
210
230
|
create: Skapa Snippet
|
|
211
231
|
cancel: Avbryt
|
|
212
232
|
update: Uppdatera Snippet
|
|
233
|
+
usage:
|
|
234
|
+
no_references: Inga referenser hittades.
|
|
235
|
+
incomplete: Listan över var denna snippet används kan vara ofullständig.
|
|
213
236
|
|
|
214
237
|
revisions:
|
|
215
238
|
reverted: Innehåll återställt
|
data/config/locales/tr.yml
CHANGED
|
@@ -65,6 +65,26 @@ tr:
|
|
|
65
65
|
files: Dosyalar
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
tag_usage:
|
|
69
|
+
title: Etiket kullanımı
|
|
70
|
+
scope: Yayımlanmamış içerik dahil bu sitenin tüm kayıtlı içeriği. Çalışma zamanında işleme yapılmaz.
|
|
71
|
+
multisite: Bu tek site raporu, birden çok sitenin genel izin listeleri için kapsamlı değildir.
|
|
72
|
+
partial: Kısmi şablonlar
|
|
73
|
+
helper: Yardımcı metotlar
|
|
74
|
+
template: Şablonlar
|
|
75
|
+
name: Ad
|
|
76
|
+
status: Geçerli durum
|
|
77
|
+
sources: Kaynaklar
|
|
78
|
+
used_in: Kullanıldığı yerler
|
|
79
|
+
no_results: Eşleşen etiket bulunamadı.
|
|
80
|
+
incomplete: Rapor eksik. Bazı içerikler taranamadı; aşağıdaki uyarıları inceleyin.
|
|
81
|
+
warnings: Tarama uyarıları
|
|
82
|
+
config: Önerilen yapılandırma
|
|
83
|
+
review: Kullanmadan önce inceleyin. Bu öneri otomatik izin veya güvenlik onayı değildir. Hiçbir yapılandırma değiştirilmedi.
|
|
84
|
+
explicitly_allowed: Açıkça izin verilmiş
|
|
85
|
+
allowed_by_default: Varsayılan olarak izin verilmiş
|
|
86
|
+
blocked: Engellenmiş
|
|
87
|
+
|
|
68
88
|
search:
|
|
69
89
|
submit: Ara
|
|
70
90
|
clear: Temizle
|
|
@@ -210,6 +230,9 @@ tr:
|
|
|
210
230
|
create: Pasaj Oluştur
|
|
211
231
|
cancel: İptal
|
|
212
232
|
update: Pasajı Güncelle
|
|
233
|
+
usage:
|
|
234
|
+
no_references: Referans bulunamadı.
|
|
235
|
+
incomplete: Pasajın kullanıldığı yerlerin listesi eksik olabilir.
|
|
213
236
|
|
|
214
237
|
revisions:
|
|
215
238
|
reverted: İçerik Geri Alındı
|
data/config/locales/uk.yml
CHANGED
|
@@ -65,6 +65,26 @@ uk:
|
|
|
65
65
|
files: Файли
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
tag_usage:
|
|
69
|
+
title: Використання тегів
|
|
70
|
+
scope: Увесь збережений вміст цього сайту, включно з неопублікованим. Без рендерингу під час виконання.
|
|
71
|
+
multisite: Цей звіт для одного сайту не є вичерпним для глобальних списків дозволів кількох сайтів.
|
|
72
|
+
partial: Часткові шаблони
|
|
73
|
+
helper: Допоміжні методи
|
|
74
|
+
template: Шаблони
|
|
75
|
+
name: Назва
|
|
76
|
+
status: Поточний стан
|
|
77
|
+
sources: Джерела
|
|
78
|
+
used_in: Використано в
|
|
79
|
+
no_results: Відповідних тегів не знайдено.
|
|
80
|
+
incomplete: Звіт неповний. Частину вмісту не вдалося проаналізувати; перегляньте попередження нижче.
|
|
81
|
+
warnings: Попередження аналізу
|
|
82
|
+
config: Запропонована конфігурація
|
|
83
|
+
review: Перевірте перед використанням. Пропозиція не є автоматичним дозволом або підтвердженням безпеки. Конфігурацію не змінено.
|
|
84
|
+
explicitly_allowed: Явно дозволено
|
|
85
|
+
allowed_by_default: Дозволено за замовчуванням
|
|
86
|
+
blocked: Заблоковано
|
|
87
|
+
|
|
68
88
|
search:
|
|
69
89
|
submit: Пошук
|
|
70
90
|
clear: Очистити
|
|
@@ -210,6 +230,9 @@ uk:
|
|
|
210
230
|
create: Створити сніппет
|
|
211
231
|
cancel: Cкасувати
|
|
212
232
|
update: Оновити сніппет
|
|
233
|
+
usage:
|
|
234
|
+
no_references: Посилань не знайдено.
|
|
235
|
+
incomplete: Список місць, де використано сніппет, може бути неповним.
|
|
213
236
|
|
|
214
237
|
revisions:
|
|
215
238
|
reverted: Контент повернутий до попереднього стану
|
data/config/locales/zh-CN.yml
CHANGED
|
@@ -65,6 +65,26 @@ zh-CN:
|
|
|
65
65
|
files: 文件
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
tag_usage:
|
|
69
|
+
title: 标签使用情况
|
|
70
|
+
scope: 此站点的所有已保存内容,包括未发布的内容。不进行运行时渲染。
|
|
71
|
+
multisite: 此报告仅涵盖当前站点,不能完整反映多站点全局允许列表的需求。
|
|
72
|
+
partial: 局部模板
|
|
73
|
+
helper: 辅助方法
|
|
74
|
+
template: 模板
|
|
75
|
+
name: 名称
|
|
76
|
+
status: 当前状态
|
|
77
|
+
sources: 来源
|
|
78
|
+
used_in: 使用位置
|
|
79
|
+
no_results: 未找到匹配的标签。
|
|
80
|
+
incomplete: 报告不完整。部分内容无法扫描,请查看下面的警告。
|
|
81
|
+
warnings: 扫描警告
|
|
82
|
+
config: 候选配置
|
|
83
|
+
review: 使用前请审核。此候选配置不代表自动授权或安全批准。未更改任何配置。
|
|
84
|
+
explicitly_allowed: 明确允许
|
|
85
|
+
allowed_by_default: 默认允许
|
|
86
|
+
blocked: 已阻止
|
|
87
|
+
|
|
68
88
|
search:
|
|
69
89
|
submit: 搜索
|
|
70
90
|
clear: 清除
|
|
@@ -210,6 +230,9 @@ zh-CN:
|
|
|
210
230
|
create: 创建片段
|
|
211
231
|
cancel: 取消
|
|
212
232
|
update: 更新片段
|
|
233
|
+
usage:
|
|
234
|
+
no_references: 未找到引用。
|
|
235
|
+
incomplete: 片段的引用列表可能不完整。
|
|
213
236
|
|
|
214
237
|
revisions:
|
|
215
238
|
reverted: 内容恢复成功
|
data/config/locales/zh-TW.yml
CHANGED
|
@@ -65,6 +65,26 @@ zh-TW:
|
|
|
65
65
|
files: 文件
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
tag_usage:
|
|
69
|
+
title: 標籤使用情況
|
|
70
|
+
scope: 此站點的所有已儲存內容,包括未發佈的內容。不進行執行時渲染。
|
|
71
|
+
multisite: 此報告僅涵蓋目前站點,無法完整反映多站點全域允許清單的需求。
|
|
72
|
+
partial: 局部範本
|
|
73
|
+
helper: 輔助方法
|
|
74
|
+
template: 範本
|
|
75
|
+
name: 名稱
|
|
76
|
+
status: 目前狀態
|
|
77
|
+
sources: 來源
|
|
78
|
+
used_in: 使用位置
|
|
79
|
+
no_results: 找不到符合的標籤。
|
|
80
|
+
incomplete: 報告不完整。部分內容無法掃描,請查看下方的警告。
|
|
81
|
+
warnings: 掃描警告
|
|
82
|
+
config: 候選設定
|
|
83
|
+
review: 使用前請審核。此候選設定不代表自動授權或安全核准。未變更任何設定。
|
|
84
|
+
explicitly_allowed: 明確允許
|
|
85
|
+
allowed_by_default: 預設允許
|
|
86
|
+
blocked: 已封鎖
|
|
87
|
+
|
|
68
88
|
search:
|
|
69
89
|
submit: 搜尋
|
|
70
90
|
clear: 清除
|
|
@@ -210,6 +230,9 @@ zh-TW:
|
|
|
210
230
|
create: 創建片段
|
|
211
231
|
cancel: 取消
|
|
212
232
|
update: 更新片段
|
|
233
|
+
usage:
|
|
234
|
+
no_references: 找不到任何參照。
|
|
235
|
+
incomplete: 片段的參照清單可能不完整。
|
|
213
236
|
|
|
214
237
|
revisions:
|
|
215
238
|
reverted: 內容恢復成功
|
|
@@ -53,9 +53,9 @@ class ComfyMiddleSeat::Configuration
|
|
|
53
53
|
# @return [Boolean]
|
|
54
54
|
attr_accessor :allow_erb
|
|
55
55
|
|
|
56
|
-
#
|
|
57
|
-
# all helpers are allowed except `eval`, `
|
|
58
|
-
#
|
|
56
|
+
# Allowlist of helper methods available via {{cms:helper}}. With no array configured,
|
|
57
|
+
# all helpers are allowed except `eval`, `class_eval`, `instance_eval`, and `render`.
|
|
58
|
+
# An explicit array allows only its listed names; an empty array blocks all helpers.
|
|
59
59
|
attr_accessor :allowed_helpers
|
|
60
60
|
|
|
61
61
|
# Whitelist of partials paths that can be used via {{cms:partial}} tag. All partials
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'cgi'
|
|
4
|
+
|
|
5
|
+
# List the saved records that directly reference each requested snippet.
|
|
6
|
+
class ComfyMiddleSeat::Content::SnippetUsage
|
|
7
|
+
def initialize(site:, snippets:)
|
|
8
|
+
@site = site
|
|
9
|
+
@snippet_ids = snippets.to_h { |snippet| [snippet.identifier_in_database, snippet.id] }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def call
|
|
13
|
+
return { sources_by_id: {}, complete: true } if @snippet_ids.empty?
|
|
14
|
+
|
|
15
|
+
report = ComfyMiddleSeat::Content::TagUsage.new(sites: [@site], kinds: ['snippet']).call
|
|
16
|
+
entries = report[:entries].select { |entry| @snippet_ids.key?(entry[:name]) }
|
|
17
|
+
records = referenced_records(entries)
|
|
18
|
+
sources_by_id = entries.to_h do |entry|
|
|
19
|
+
snippet_id = @snippet_ids.fetch(entry[:name])
|
|
20
|
+
keys = entry[:sources].map { |source| record_key(source) }.uniq
|
|
21
|
+
sources = (keys - [['snippet', snippet_id]]).filter_map { |key| records[key] }
|
|
22
|
+
[snippet_id, sources.sort_by { |source| [source[:type], source[:label].to_s.downcase, source[:id]] }]
|
|
23
|
+
end
|
|
24
|
+
{ sources_by_id: sources_by_id, complete: report[:complete] }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def record_key(source)
|
|
30
|
+
source[:type] == 'translation' ? ['page', source[:page_id]] : source.values_at(:type, :id)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def referenced_records(entries)
|
|
34
|
+
keys = entries.flat_map { |entry| entry[:sources].map { |source| record_key(source) } }.uniq
|
|
35
|
+
keys.group_by(&:first).each_with_object({}) do |(type, group), records|
|
|
36
|
+
page = type == 'page'
|
|
37
|
+
field = page ? :slug : :identifier
|
|
38
|
+
@site.public_send("#{type}s").where(id: group.map(&:last)).pluck(:id, :label, field).each do |id, label, identifier|
|
|
39
|
+
identifier = CGI.unescape(identifier.to_s) if page
|
|
40
|
+
records[[type, id]] = { type: type, site_id: @site.id, id: id, label: label, identifier: identifier.presence || id.to_s }
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Inventory raw CMS content without expanding tags or consulting rendered caches.
|
|
4
|
+
class ComfyMiddleSeat::Content::TagUsage
|
|
5
|
+
BATCH_SIZE = 1000
|
|
6
|
+
KINDS = {
|
|
7
|
+
'partial' => 'partial',
|
|
8
|
+
'render_partial' => 'partial',
|
|
9
|
+
'helper' => 'helper',
|
|
10
|
+
'template' => 'template',
|
|
11
|
+
'render_template' => 'template',
|
|
12
|
+
'snippet' => 'snippet'
|
|
13
|
+
}.freeze
|
|
14
|
+
ALLOWLIST_KINDS = %w[partial helper template].freeze
|
|
15
|
+
|
|
16
|
+
def initialize(sites: nil, scope: nil, kinds: ALLOWLIST_KINDS)
|
|
17
|
+
@sites = sites || Comfy::Cms::Site.all
|
|
18
|
+
@scope = scope || (sites.nil? ? 'all_sites' : 'selected_sites')
|
|
19
|
+
@kinds = KINDS.select { |_tag, kind| kinds.include?(kind) }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def call
|
|
23
|
+
@renderer = ComfyMiddleSeat::Content::Renderer.new(nil)
|
|
24
|
+
@entries = {}
|
|
25
|
+
@warnings = []
|
|
26
|
+
@source_count = 0
|
|
27
|
+
@allowlists = (@kinds.values & ALLOWLIST_KINDS).to_h do |kind|
|
|
28
|
+
allowed = ComfyMiddleSeat.config.public_send("allowed_#{kind}s")
|
|
29
|
+
next [kind, nil] unless allowed.is_a?(Array)
|
|
30
|
+
|
|
31
|
+
# Only helper rendering stringifies allowlists; view paths use exact membership.
|
|
32
|
+
[kind, kind == 'helper' ? allowed.map(&:to_s) : allowed.dup]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
sites = site_details
|
|
36
|
+
site_ids = sites.map { |site| site[:id] }
|
|
37
|
+
scan_content(Comfy::Cms::Layout.where(site_id: site_ids), 'layout')
|
|
38
|
+
scan_content(Comfy::Cms::Snippet.where(site_id: site_ids), 'snippet')
|
|
39
|
+
scan_fragments(Comfy::Cms::Page.where(site_id: site_ids), 'page')
|
|
40
|
+
scan_fragments(Comfy::Cms::Translation.joins(:page).where(comfy_cms_pages: { site_id: site_ids }), 'translation')
|
|
41
|
+
|
|
42
|
+
{
|
|
43
|
+
scope: @scope,
|
|
44
|
+
sites: sites,
|
|
45
|
+
source_count: @source_count,
|
|
46
|
+
complete: @warnings.empty?,
|
|
47
|
+
entries: @entries.sort_by { |key, _entry| key }.map { |_key, entry| entry.merge(sources: entry[:sources].values) },
|
|
48
|
+
warnings: @warnings
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
def site_details
|
|
55
|
+
sites = []
|
|
56
|
+
collect = ->(site) { sites << { id: site.id, identifier: site.identifier, label: site.label } }
|
|
57
|
+
if @sites.respond_to?(:find_each)
|
|
58
|
+
@sites.find_each(batch_size: BATCH_SIZE, &collect)
|
|
59
|
+
else
|
|
60
|
+
@sites.each(&collect)
|
|
61
|
+
end
|
|
62
|
+
sites.uniq { |site| site[:id] }.sort_by { |site| site[:id] }
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def scan_content(records, type)
|
|
66
|
+
records.select(:id, :site_id, :label, :content).readonly.find_each(batch_size: BATCH_SIZE) do |record|
|
|
67
|
+
scan(record.content, {
|
|
68
|
+
site_id: record.site_id, type: type, id: record.id,
|
|
69
|
+
label: record.label, field: 'content', page_id: nil
|
|
70
|
+
})
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def scan_fragments(records, type)
|
|
75
|
+
table = records.klass.table_name
|
|
76
|
+
columns = ["#{table}.id", "#{table}.label", 'comfy_cms_pages.site_id']
|
|
77
|
+
columns << "#{table}.page_id" if type == 'translation'
|
|
78
|
+
|
|
79
|
+
# Pluck owner metadata rather than loading pages, their caches or associations.
|
|
80
|
+
records.in_batches(of: BATCH_SIZE) do |batch|
|
|
81
|
+
sources = batch.pluck(*columns).to_h do |id, label, site_id, page_id|
|
|
82
|
+
[id, { site_id: site_id, type: type, id: id, label: label, page_id: page_id }]
|
|
83
|
+
end
|
|
84
|
+
fragments = Comfy::Cms::Fragment.where(record_type: records.klass.polymorphic_name, record_id: sources.keys)
|
|
85
|
+
fragments.select(:id, :record_id, :identifier, :content).readonly.find_each(batch_size: BATCH_SIZE) do |fragment|
|
|
86
|
+
content = fragment.content
|
|
87
|
+
next unless content.is_a?(String)
|
|
88
|
+
|
|
89
|
+
scan(content, sources.fetch(fragment.record_id).merge(field: fragment.identifier))
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def scan(content, source)
|
|
95
|
+
@source_count += 1
|
|
96
|
+
@renderer.tokenize(content).each do |token|
|
|
97
|
+
next unless token.is_a?(Hash) && (kind = @kinds[token[:tag_class]])
|
|
98
|
+
|
|
99
|
+
scan_token(token, kind, source)
|
|
100
|
+
end
|
|
101
|
+
rescue ComfyMiddleSeat::Content::Renderer::SyntaxError => e
|
|
102
|
+
@warnings << { source: source, message: "Cannot tokenize source: #{e.message}" }
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def scan_token(token, kind, source)
|
|
106
|
+
name = ComfyMiddleSeat::Content::ParamsParser.new(token[:tag_params]).params.first
|
|
107
|
+
unless name.is_a?(String) && name.present?
|
|
108
|
+
@warnings << { source: source, message: "Missing, blank or non-string name in #{token[:source]}" }
|
|
109
|
+
return
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
entry = @entries[[kind, name]] ||= { kind: kind, name: name, status: status(kind, name), sources: {} }
|
|
113
|
+
entry[:sources][source] = source
|
|
114
|
+
rescue ComfyMiddleSeat::Content::ParamsParser::Error => e
|
|
115
|
+
@warnings << { source: source, message: "Cannot parse #{token[:source]}: #{e.message}" }
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def status(kind, name)
|
|
119
|
+
return unless @allowlists.key?(kind)
|
|
120
|
+
|
|
121
|
+
if (allowed = @allowlists[kind])
|
|
122
|
+
allowed.include?(name) ? 'explicitly_allowed' : 'blocked'
|
|
123
|
+
elsif kind == 'helper' && ComfyMiddleSeat::Content::Tags::Helper::BLACKLIST.include?(name)
|
|
124
|
+
'blocked'
|
|
125
|
+
else
|
|
126
|
+
'allowed_by_default'
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|