AndreaNotes1 commited on
Commit
db9f9f5
·
verified ·
1 Parent(s): 980ecdf

Upload 38 files

Browse files
scripts/assets/aynwerd-watermark-logo.png CHANGED
src/controllers/content.controller.js CHANGED
@@ -51,7 +51,7 @@ async function getLessonAccess(req, res, next) {
51
 
52
  const { url, expiresAt } = getSignedPlaybackUrl(lesson.cloudinaryPublicId, lesson.cloudinaryResourceType, {
53
  format: lesson.format,
54
- viewer: { name: req.user.name, email: req.user.email },
55
  });
56
 
57
  await AuditLog.create({
 
51
 
52
  const { url, expiresAt } = getSignedPlaybackUrl(lesson.cloudinaryPublicId, lesson.cloudinaryResourceType, {
53
  format: lesson.format,
54
+ viewer: { email: req.user.email },
55
  });
56
 
57
  await AuditLog.create({
src/utils/cloudinaryUpload.js CHANGED
@@ -61,43 +61,40 @@ function deleteAsset(publicId, resourceType) {
61
  }
62
 
63
  /**
64
- * Builds the overlay layers that stamp a video with the viewing
65
- * learner's identity plus the Aynwerd logo, so any leaked/recorded
66
- * copy is traceable back to the account it leaked from and is visibly
67
- * branded as Aynwerd's property. Applied at request time, per viewer —
68
- * nothing pre-baked, so the same source video is watermarked
69
- * differently for every learner who opens it.
70
  *
71
- * The identity text is stamped in two opposite corners (not just one)
72
- * so a casual crop/re-frame of the recording doesn't remove it
73
- * entirely.
 
74
  */
75
- function buildWatermarkTransformation({ name, email }) {
76
- const label = `${name} • ${email}`;
77
- const textLayer = (gravity) => ({
78
- overlay: {
79
- font_family: "Arial",
80
- font_size: 20,
81
- font_weight: "bold",
82
- text: label,
83
- },
84
- color: "white",
85
- opacity: 45,
86
- gravity,
87
- x: 18,
88
- y: 18,
89
- });
90
-
91
  return [
92
- textLayer("north_west"),
93
- textLayer("south_east"),
94
  {
95
  overlay: { public_id: WATERMARK_LOGO_PUBLIC_ID, resource_type: "image" },
96
- width: 130,
97
- opacity: 40,
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  gravity: "south_west",
99
- x: 18,
100
- y: 18,
101
  },
102
  ];
103
  }
@@ -108,8 +105,8 @@ function buildWatermarkTransformation({ name, email }) {
108
  * cannot be redistributed as a permanent download.
109
  *
110
  * When `viewer` is provided and the asset is a video, the URL also
111
- * carries a per-viewer watermark transformation (see
112
- * buildWatermarkTransformation above) — Cloudinary renders that
113
  * watermarked derivative on the fly and signs the transformed URL, so
114
  * the overlay can't be stripped without the original signed request.
115
  * Watermarking only applies to video; document/raw lessons (PDFs,
 
61
  }
62
 
63
  /**
64
+ * Builds the overlay layers that stamp a video with the Aynwerd logo
65
+ * plus the viewing learner's email, so any leaked/recorded copy is
66
+ * both clearly branded and traceable back to the account it leaked
67
+ * from. Applied at request time, per viewer — nothing pre-baked, so
68
+ * the same source video is watermarked differently for every learner
69
+ * who opens it.
70
  *
71
+ * Logo sits top-right (matching a standard, clearly-visible corner
72
+ * bug like most watermarked platform videos), email sits bottom-left
73
+ * — opposite corner, so the two marks don't overlap and a crop that
74
+ * removes one is unlikely to remove both.
75
  */
76
+ function buildWatermarkTransformation({ email }) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  return [
 
 
78
  {
79
  overlay: { public_id: WATERMARK_LOGO_PUBLIC_ID, resource_type: "image" },
80
+ width: 160,
81
+ opacity: 90,
82
+ gravity: "north_east",
83
+ x: 24,
84
+ y: 24,
85
+ },
86
+ {
87
+ overlay: {
88
+ font_family: "Arial",
89
+ font_size: 22,
90
+ font_weight: "bold",
91
+ text: email,
92
+ },
93
+ color: "white",
94
+ opacity: 85,
95
  gravity: "south_west",
96
+ x: 20,
97
+ y: 20,
98
  },
99
  ];
100
  }
 
105
  * cannot be redistributed as a permanent download.
106
  *
107
  * When `viewer` is provided and the asset is a video, the URL also
108
+ * carries a per-viewer watermark (Aynwerd logo + the learner's email —
109
+ * see buildWatermarkTransformation above) — Cloudinary renders that
110
  * watermarked derivative on the fly and signs the transformed URL, so
111
  * the overlay can't be stripped without the original signed request.
112
  * Watermarking only applies to video; document/raw lessons (PDFs,