Skip to content

Commit 0000c71

Browse files
authored
🔀 Merge pull request #486 from FrostCo/changes
Changes
2 parents 6c36276 + 3f0b812 commit 0000c71

File tree

124 files changed

+9482
-16524
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+9482
-16524
lines changed

.gitattributes

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,3 @@ text eol=lf
99
/src/static/w3-color-flat.css linguist-vendored
1010
/store/* linguist-vendored
1111
/test/* linguist-documentation
12-
13-
# Filters (clean/smudge)
14-
"safari/Advanced Profanity Filter.xcodeproj/project.pbxproj" filter=safari
15-
"safari/Shared (App)/ViewController.swift" filter=safari

.vscode/extensions.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"recommendations": [
3-
"kamikillerto.vscode-colorize",
43
"dbaeumer.vscode-eslint",
5-
"shardulm94.trailing-spaces"
4+
"kamikillerto.vscode-colorize",
5+
"shardulm94.trailing-spaces",
6+
"vscode-icons-team.vscode-icons"
67
]
78
}

.vscode/settings.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"files.associations": {
33
"**/*.js.example": "javascript"
4-
}
4+
},
5+
"vsicons.associations.files": [
6+
{
7+
"icon": "webpack",
8+
"extensions": [
9+
"webpack.bookmarklet.js"
10+
],
11+
"filename": true,
12+
"format": "svg"
13+
}
14+
]
515
}

bin/copy-static.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ import fse from 'fs-extra';
33

44
console.log('Copying static assets to ./dist folder...');
55
fse.copySync('./src/static', './dist');
6-
fse.copySync('./src/audio', './dist/audio');
76
fse.copySync('./src/img', './dist/img');

bin/git-filters/safari.js.example

Lines changed: 0 additions & 76 deletions
This file was deleted.

bin/package-extension.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable no-console */
22
import AdmZip from 'adm-zip';
3+
import { globbySync } from 'globby';
34
import { buildFilePath, loadJSONFile, removeFiles } from './lib.mjs';
45

56
let buildData;
@@ -8,6 +9,14 @@ const dist = './dist/';
89
function buildArchive() {
910
const zip = new AdmZip();
1011
zip.addLocalFolder(dist, null);
12+
13+
// Remove unwanted files
14+
const filesToRemove = globbySync(['dist/**/*.LICENSE.txt']);
15+
for (const file of filesToRemove) {
16+
const entry = file.replace(/^dist\//, '');
17+
zip.deleteFile(entry);
18+
}
19+
1120
return zip;
1221
}
1322

bin/postbuild.mjs

Lines changed: 1 addition & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,16 @@
11
/* eslint-disable @typescript-eslint/naming-convention */
22
/* eslint-disable no-console */
33
import fse from 'fs-extra';
4-
import path from 'path';
54
import {
65
buildFilePath,
76
distManifestPath,
87
loadJSONFile,
9-
removeFiles,
108
srcManifestPath,
119
writeJSONFile
1210
} from './lib.mjs';
1311

1412
let buildData;
15-
16-
function appleBuild(updateBuildNumber) {
17-
const files = [
18-
path.join('dist', 'img', 'donate.gif'),
19-
path.join('dist', 'img', 'patreon-small.png'),
20-
path.join('dist', 'img', 'patreon.png'),
21-
];
22-
23-
removeOptionPageBookmarklet();
24-
removeOptionPageDonations();
25-
removeFiles(files);
26-
27-
if (buildData.release) {
28-
updateSafariXcodeVersion(updateBuildNumber);
29-
}
30-
}
13+
let distDir = 'dist';
3114

3215
function common() {
3316
handleManifestVersion();
@@ -88,7 +71,6 @@ function handleManifestVersion() {
8871
default_title: 'Advanced Profanity Filter',
8972
};
9073
manifest.host_permissions = undefined;
91-
manifest.web_accessible_resources = ['audio/*.mp3'];
9274
writeJSONFile(distManifestPath, manifest);
9375
}
9476
}
@@ -108,11 +90,6 @@ function handleVersion() {
10890
}
10991
}
11092

111-
function iOSBuild() {
112-
const updateBuildNumber = false;
113-
appleBuild(updateBuildNumber);
114-
}
115-
11693
function main() {
11794
buildData = loadJSONFile(buildFilePath);
11895

@@ -126,67 +103,6 @@ function main() {
126103
if (buildData.target == 'firefox') {
127104
firefoxBuild();
128105
}
129-
130-
if (buildData.target == 'ios') {
131-
iOSBuild();
132-
}
133-
134-
if (buildData.target == 'safari') {
135-
safariBuild();
136-
}
137-
}
138-
139-
function removeOptionPageBookmarklet() {
140-
console.log("Removing Bookmarklet tab from Option's page");
141-
const optionPage = path.join('dist', 'optionPage.html');
142-
const optionPageHTML = fse.readFileSync(optionPage).toString();
143-
144-
// Remove div#menu a[href='#/bookmarklet']
145-
// const donationsRegex = new RegExp();
146-
const newOptionPageHTML = optionPageHTML.replace(' <a href="#/bookmarklet" class="w3-bar-item w3-button">Bookmarklet</a>', '');
147-
148-
// Save changes
149-
fse.writeFileSync(optionPage, newOptionPageHTML);
150-
}
151-
152-
function removeOptionPageDonations() {
153-
console.log("Removing donations from Option's page");
154-
const optionPage = path.join('dist', 'optionPage.html');
155-
const optionPageHTML = fse.readFileSync(optionPage).toString();
156-
157-
// Remove span.donations
158-
const donationsRegex = new RegExp('[\\s\\S]{4}<span class="donations">[\\s\\S].*[\\s\\S]+?<\/span>');
159-
const newOptionPageHTML = optionPageHTML.replace(donationsRegex, '');
160-
161-
// Save changes
162-
fse.writeFileSync(optionPage, newOptionPageHTML);
163-
}
164-
165-
function safariBuild() {
166-
const updateBuildNumber = true;
167-
appleBuild(updateBuildNumber);
168-
}
169-
170-
function updateSafariXcodeVersion(updateBuildNumber) {
171-
const projectFilePath = path.join('safari', 'Advanced Profanity Filter.xcodeproj', 'project.pbxproj');
172-
const projectFileText = fse.readFileSync(projectFilePath).toString();
173-
let updatedProjectFileText = projectFileText.replace(/MARKETING_VERSION = \d+\.\d+\.\d+;$/gm, `MARKETING_VERSION = ${buildData.version};`);
174-
175-
// Increment the build version when running a Safari release
176-
// macOS Apps require the build number to be larger than the previous build number
177-
// https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
178-
if (updateBuildNumber) {
179-
const buildVersionMatch = projectFileText.match(/CURRENT_PROJECT_VERSION = (?<buildNumber>\d+);/);
180-
if (buildVersionMatch.groups) {
181-
const newBuildNumber = parseInt(buildVersionMatch.groups.buildNumber) + 1;
182-
updatedProjectFileText = updatedProjectFileText.replace(/CURRENT_PROJECT_VERSION = (?<buildNumber>\d+);/gm, `CURRENT_PROJECT_VERSION = ${newBuildNumber};`);
183-
}
184-
}
185-
186-
if (projectFileText !== updatedProjectFileText) {
187-
console.log('Updating Xcode project version...');
188-
fse.writeFileSync(projectFilePath, updatedProjectFileText);
189-
}
190106
}
191107

192108
main();

bin/prebuild.mjs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import { buildFilePath, devBuildFilePath, loadJSONFile, parseArgv, releaseBuildF
55

66
let data = {
77
release: false,
8-
config: {
9-
muteMethod: null,
10-
},
8+
config: {},
119
manifestVersion: 2,
1210
target: 'chrome',
1311
version: '1.0.0',
@@ -38,11 +36,6 @@ function firefoxBuild() {
3836
data.target = 'firefox';
3937
}
4038

41-
function iOSBuild() {
42-
data.target = 'ios';
43-
data.config.muteMethod = 2; // Constants.MUTE_METHODS.VIDEO_MUTE;
44-
}
45-
4639
function main() {
4740
const argv = parseArgv(process.argv);
4841
if (argv.count >= 2 && argv.count <= 4) {
@@ -78,18 +71,12 @@ function main() {
7871
case '--firefox':
7972
firefoxBuild();
8073
break;
81-
case '--ios':
82-
iOSBuild();
83-
break;
8474
case '--manifestV2':
8575
manifestV2Build();
8676
break;
8777
case '--manifestV3':
8878
manifestV3Build();
8979
break;
90-
case '--safari':
91-
safariBuild();
92-
break;
9380
default:
9481
defaultBuild();
9582
}
@@ -113,19 +100,12 @@ function manifestV3Build() {
113100
data.manifestVersion = 3;
114101
}
115102

116-
function safariBuild() {
117-
data.target = 'safari';
118-
data.config.muteMethod = 2; // Constants.MUTE_METHODS.VIDEO_MUTE;
119-
}
120-
121103
function targetFromData() {
122104
switch (data.target) {
123105
case 'chrome':
124106
return `--manifestV${data.manifestVersion}`;
125107
case 'bookmarklet':
126108
case 'firefox:':
127-
case 'ios':
128-
case 'safari':
129109
return `--${data.target}`;
130110
}
131111
}

bin/update-bookmarklet.mjs

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)