Skip to content

Commit

Permalink
Fingerprint during Ember build
Browse files Browse the repository at this point in the history
  • Loading branch information
HarveyKandola committed Sep 8, 2021
1 parent e19c4ad commit eea8db9
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 34 deletions.
4 changes: 4 additions & 0 deletions domain/document/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import (
"github.com/documize/community/model/space"
"github.com/documize/community/model/user"
"github.com/documize/community/model/workflow"
"github.com/microcosm-cc/bluemonday"
)

// Handler contains the runtime information such as logging and database.
Expand Down Expand Up @@ -270,6 +271,9 @@ func (h *Handler) Update(w http.ResponseWriter, r *http.Request) {
}
}

d.Name = bluemonday.StrictPolicy().Sanitize(d.Name)
d.Excerpt = bluemonday.StrictPolicy().Sanitize(d.Excerpt)

err = h.Store.Document.Update(ctx, d)
if err != nil {
h.Runtime.Rollback(ctx.Transaction)
Expand Down
1 change: 1 addition & 0 deletions domain/section/frame/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ func (*Provider) Refresh(ctx *provider.Context, config, data string) string {
}

func embed(config, data string) string {
// return bluemonday.UGCPolicy().Sanitize(data)
return data
}
1 change: 1 addition & 0 deletions domain/section/markdown/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func (*Provider) Command(ctx *provider.Context, w http.ResponseWriter, r *http.R
}

// Render converts markdown data into HTML suitable for browser rendering.
// See also https://github.com/yuin/goldmark
func (*Provider) Render(ctx *provider.Context, config, data string) string {
unsafe := blackfriday.Run([]byte(data))

Expand Down
4 changes: 3 additions & 1 deletion domain/space/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"github.com/documize/community/model/space"
"github.com/documize/community/model/user"
wf "github.com/documize/community/model/workflow"
"github.com/microcosm-cc/bluemonday"
uuid "github.com/nu7hatch/gouuid"
)

Expand Down Expand Up @@ -99,7 +100,8 @@ func (h *Handler) Add(w http.ResponseWriter, r *http.Request) {

var sp space.Space
sp.Name = model.Name
sp.Description = model.Description
sp.Description = bluemonday.StrictPolicy().Sanitize(model.Description)

sp.Icon = model.Icon
sp.LabelID = model.LabelID
sp.RefID = uniqueid.Generate()
Expand Down
2 changes: 1 addition & 1 deletion edition/community.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func main() {
rt.Product.Major = "4"
rt.Product.Minor = "0"
rt.Product.Patch = "0"
rt.Product.Revision = "210817183831"
rt.Product.Revision = "210907143905"
rt.Product.Version = fmt.Sprintf("%s.%s.%s", rt.Product.Major, rt.Product.Minor, rt.Product.Patch)
rt.Product.Edition = domain.CommunityEdition
rt.Product.Title = fmt.Sprintf("%s Edition", rt.Product.Edition)
Expand Down
67 changes: 35 additions & 32 deletions gui/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,51 @@ let isDevelopment = EmberApp.env() === 'development';

module.exports = function(defaults) {
let app = new EmberApp(defaults, {
'ember-cli-terser': {
enabled: !isDevelopment,
exclude: ['tinymce/**', 'codemirror/**', 'prism/**', 'pdfjs/**'],

hiddenSourceMap: true,

fingerprint: {
fingerprint: {
enabled: true,
generateAssetMap: true,
fingerprintAssetMap: true,
fingerprintAssetMap: false,
prepend: '/',
extensions: ['js', 'css'],
exclude: ['tinymce/**', 'codemirror/**', 'prism/**', 'pdfjs/**']
},
},

minifyJS: {
enabled: !isDevelopment,
options: {
exclude: ['tinymce/**', 'codemirror/**', 'prism/**', 'pdfjs/**']
}
},
minifyCSS: {
enabled: !isDevelopment,
options: {
exclude: ['tinymce/**', 'codemirror/**', 'prism/**', 'pdfjs/**']
}
},

minifyCSS: {
enabled: !isDevelopment,
options: {
exclude: ['tinymce/**', 'codemirror/**', 'prism/**', 'pdfjs/**']
outputPaths: {
app: {
css: {
'app': '/assets/documize.css',
'themes/conference': '/assets/theme-conference.css',
'themes/forest': '/assets/theme-forest.css',
'themes/brave': '/assets/theme-brave.css',
'themes/harvest': '/assets/theme-harvest.css',
'themes/sunflower': '/assets/theme-sunflower.css',
'themes/silver': '/assets/theme-silver.css',
}
}
},

'ember-cli-terser': {
enabled: !isDevelopment,
exclude: ['tinymce/**', 'codemirror/**', 'prism/**', 'pdfjs/**'],

hiddenSourceMap: true,

terser: {
},

outputPaths: {
app: {
css: {
'app': '/assets/documize.css',
'themes/conference': '/assets/theme-conference.css',
'themes/forest': '/assets/theme-forest.css',
'themes/brave': '/assets/theme-brave.css',
'themes/harvest': '/assets/theme-harvest.css',
'themes/sunflower': '/assets/theme-sunflower.css',
'themes/silver': '/assets/theme-silver.css',
}
}
}
// minifyJS: {
// enabled: !isDevelopment,
// options: {
// exclude: ['tinymce/**', 'codemirror/**', 'prism/**', 'pdfjs/**']
// }
// },
},
});

Expand Down

0 comments on commit eea8db9

Please sign in to comment.