Skip to content

Commit b7d6bd5

Browse files
authored
Merge pull request #2 from lusitdev/manifest-v3
Manifest v3
2 parents 3080ee1 + cfdb188 commit b7d6bd5

24 files changed

+4274
-268
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules/
2+
build
3+
test
4+
5+
*.zip
6+
7+
.DS_Store

README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
1-
2-
![Adstxter logo](store-assets/128.png)
1+
![Adstxter logo](src/common/images/48.png)
32

43
# Adstxter
54

6-
A simple chrome extension for checking [ads.txt](https://iabtechlab.com/ads-txt-about/) files. Provides a one-click test for the presence of given sellers. Active only when started by a user, otherwise it's suspended and not draining any resources. Handling of ads.txt follows the [IAB Tech Lab ads.txt Specification Version 1.0.2](https://iabtechlab.com/wp-content/uploads/2019/03/IAB-OpenRTB-Ads.txt-Public-Spec-1.0.2.pdf).
5+
A simple chrome extension for checking [ads.txt](https://iabtechlab.com/ads-txt-about/) files. Provides a one-click test for the presence of given sellers. Active only when started by a user, otherwise it's suspended and not draining any resources. Handling of ads.txt follows the [IAB Tech Lab ads.txt Specification Version 1.0.2](https://iabtechlab.com/wp-content/uploads/2019/03/IAB-OpenRTB-Ads.txt-Public-Spec-1.0.2.pdf).
76

8-
Install it from the [Chrome Webstore](https://chrome.google.com/webstore/detail/ncdnbcbfjcflaocmpnhjajngpdoipnci).
7+
Install from the [Chrome Webstore](https://chrome.google.com/webstore/detail/ncdnbcbfjcflaocmpnhjajngpdoipnci).
98

109
## Usage
1110

12-
- Test is triggered when the extension is started or new sellers are entered.
13-
- Targets the currently loaded website.
14-
15-
![Screenshot of Adstxter: test result](store-assets/screenshot640x400_1.jpg)
16-
17-
![Screenshot of Adstxter: copying the missing sellers to clipboard](store-assets/screenshot640x400_2.jpg)
11+
- Enter the list of seller seats you want to verify, as they appear in the ads.txt file.
12+
- The extension will automatically test ads.txt file on the loaded site.
1813

1914
## Limitations
2015

21-
* Checking ads.txt on subdomains is currently not implemented.
22-
* Due to JavaScript security limitations, it's not possible to control the number of redirects when fetching ads.txt. (AFAIK). As a result, the following ads.txt directive isn't honored:
16+
- Checking ads.txt on subdomains is currently not implemented.
17+
- Due to JavaScript security limitations, it's not possible to control the number of redirects when fetching ads.txt. (AFAIK). As a result, the following ads.txt directive isn't honored:
2318

2419
> Only a single HTTP redirect to a destination outside the original root domain is allowed to facilitate one-hop delegation of authority to a third party's web server domain. If the third party location returns a redirect, then the advertising system should treat the response as an error.
2520
> - *IAB Tech Lab ads.txt Specification Version 1.0.2*
2621
2722
## License
28-
Apache-2.0
23+
24+
Apache-2.0
25+
26+
## Credits
27+
28+
This project includes the following fonts from Google Fonts:
29+
30+
- **Roboto** designed by Christian Robertson, Paratype, Font Bureau, licensed under the [SIL OPEN FONT LICENSE Version 1.1](https://openfontlicense.org/open-font-license-official-text/)
31+
- **B612 Mono** designed by Nicolas Chauveau, Thomas Paillot, Jonathan Favre-Lamarine, Jean-Luc Vinot, licensed under the [SIL OPEN FONT LICENSE Version 1.1](https://openfontlicense.org/open-font-license-official-text/)

gulpfile.js

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
const gulp = require('gulp');
2+
const sass = require('gulp-sass')(require('sass'));
3+
const sourcemaps = require('gulp-sourcemaps');
4+
const postcss = require('gulp-postcss');
5+
const autoprefixerPlugin = require('autoprefixer');
6+
const zip = require('gulp-zip').default;
7+
const terser = require('gulp-terser');
8+
const htmlmin = require('gulp-htmlmin');
9+
const flatten = require('gulp-flatten');
10+
const rename = require('gulp-rename');
11+
const nodePath = require('path');
12+
13+
function compileSass(dest) {
14+
const out = dest === 'dev' ? 'nested' : 'compressed';
15+
return gulp.src('./src/chrome/scss/*.scss')
16+
.pipe(sourcemaps.init())
17+
.pipe(sass({ outputStyle: out }).on('error', sass.logError))
18+
.pipe(postcss([autoprefixerPlugin()]))
19+
.pipe(sourcemaps.write('.'))
20+
.pipe(gulp.dest(`./build/${dest}/css`));
21+
}
22+
23+
function buildDevWatch() {
24+
const dist = './build/dev';
25+
const images = './src/**/*.{png,jpg,jpeg,gif,svg}';
26+
const fonts = './src/**/fonts/**/*.{woff,woff2,txt}';
27+
const code = './src/**/*.{js,json,html}';
28+
29+
const pipe = (glob, destPath = dist, opt = null) => {
30+
if (opt && opt.fonts) {
31+
return gulp.src(glob, opt)
32+
.pipe(rename((path) => {
33+
const parts = path.dirname.split(nodePath.sep);
34+
const fontsIndex = parts.indexOf('fonts');
35+
if (fontsIndex !== -1) {
36+
// Drop everything up to “fonts,” leaving the next subfolder
37+
path.dirname = parts.slice(fontsIndex + 1).join(nodePath.sep);
38+
}
39+
}))
40+
.pipe(gulp.dest(destPath));
41+
}
42+
return gulp.src(glob, opt)
43+
.pipe(flatten())
44+
.pipe(gulp.dest(destPath));
45+
};
46+
47+
const watch = (glob, fn) => {
48+
gulp.watch(glob, { ignoreInitial: false }, fn);
49+
}
50+
51+
watch('./src/chrome/scss/*.scss', () => compileSass('dev'));
52+
watch(code, () => pipe(code));
53+
watch(images, () => pipe(images, `${dist}/img`, { encoding: false }));
54+
watch(fonts, () => pipe(fonts, `${dist}/font`, { encoding: false, fonts: true }));
55+
}
56+
57+
function buildDist() {
58+
const src = './src';
59+
const dist = './build/dist';
60+
61+
const process = (glob, transform, destPath = dist, opt = null) => {
62+
let stream = gulp.src(`${src}/${glob}`, opt);
63+
if (transform) {
64+
stream = stream.pipe(transform);
65+
}
66+
if (opt && opt.fonts) {
67+
return stream
68+
.pipe(rename((path) => {
69+
const parts = path.dirname.split(nodePath.sep);
70+
const fontsIndex = parts.indexOf('fonts');
71+
if (fontsIndex !== -1) {
72+
// Drop everything up to “fonts,” leaving the next subfolder
73+
path.dirname = parts.slice(fontsIndex + 1).join(nodePath.sep);
74+
}
75+
}))
76+
.pipe(gulp.dest(destPath));
77+
}
78+
stream = stream.pipe(flatten());
79+
return stream.pipe(gulp.dest(destPath));
80+
};
81+
82+
return Promise.all([
83+
compileSass('dist'),
84+
process('**/*.js', terser({
85+
compress: {
86+
ecma: 2020,
87+
passes: 2,
88+
drop_console: true, // Keep console for debugging or set to true for production
89+
// unsafe: true,
90+
// unsafe_methods: true
91+
},
92+
mangle: {
93+
properties: false // Don't rename properties as Chrome APIs use them
94+
},
95+
format: {
96+
comments: false,
97+
ecma: 2020,
98+
ascii_only: true
99+
}
100+
})),
101+
process('**/*.html', htmlmin({ collapseWhitespace: true })),
102+
process('**/*.{png,jpg,jpeg,gif,svg}', null, `${dist}/img`, { encoding: false }),
103+
process('**/fonts/**/*.{woff,woff2,txt}', null, `${dist}/font`, { encoding: false, fonts: true }),
104+
process('**/*.json')
105+
]);
106+
}
107+
108+
function packDist() {
109+
return gulp.src('./build/dist/**/*')
110+
.pipe(zip('adstxter.zip'))
111+
.pipe(gulp.dest('./release'));
112+
}
113+
114+
exports.buildDevWatch = buildDevWatch;
115+
exports.buildDist = buildDist;
116+
exports.packDist = packDist;

0 commit comments

Comments
 (0)