Skip to content
This repository has been archived by the owner on Jun 1, 2021. It is now read-only.

Commit

Permalink
Rename to reflect basic classifications
Browse files Browse the repository at this point in the history
  • Loading branch information
joelpurra committed Jun 23, 2014
1 parent 218435d commit bae188f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 49 deletions.
49 changes: 0 additions & 49 deletions src/classification/all.sh

This file was deleted.

38 changes: 38 additions & 0 deletions src/classification/basic.sh
@@ -0,0 +1,38 @@
#!/bin/bash
set -e

read -d '' classifyExpandedParts <<-'EOF' || true
def isSameDomain(domain):
domain as $domain
| . == $domain;
def isSubdomain(domain):
domain as $domain
| endswith("." + $domain);
def isSecure:
. == "https";
def classifyUrl(origin):
origin as $origin
| {
isSameDomain: (.domain | isSameDomain($origin.domain)),
isSubdomain: (.domain | isSubdomain($origin.domain)),
isSecure: (.protocol | isSecure)
};
def mangle(origin):
origin as $origin
| .url as $urlParts
| . + {
classification : $urlParts | classifyUrl($origin)
};
.origin.url as $origin
| {
origin: .origin | mangle($origin),
requestedUrls: .requestedUrls | map(mangle(($origin)))
}
EOF

cat | jq "$classifyExpandedParts"

0 comments on commit bae188f

Please sign in to comment.