Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kevin Martin
committed
Sep 14, 2015
1 parent
844b2eb
commit 00ac83c
Showing
10 changed files
with
284 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = tab | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# Dot files | ||
._* | ||
.DS_Store | ||
|
||
# Logs | ||
logs | ||
*.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
{ | ||
"esnext": true, | ||
"excludeFiles": ["bower_components/**", "node_modules/**"], | ||
"disallowAnonymousFunctions": true, | ||
"disallowDanglingUnderscores": { | ||
"allExcept": ["_this"] | ||
}, | ||
"disallowEmptyBlocks": true, | ||
"disallowKeywordsOnNewLine": ["else"], | ||
"disallowKeywords": ["with"], | ||
"disallowMixedSpacesAndTabs": true, | ||
"disallowMultipleLineBreaks": true, | ||
"disallowMultipleLineStrings": true, | ||
"disallowNewlineBeforeBlockStatements": true, | ||
"disallowOperatorBeforeLineBreak": ["+", "-", "/", "*", "."], | ||
"disallowPaddingNewlinesInBlocks": true, | ||
"disallowQuotedKeysInObjects": true, | ||
"disallowSpaceAfterObjectKeys": true, | ||
"disallowSpaceAfterPrefixUnaryOperators": true, | ||
"disallowSpaceBeforePostfixUnaryOperators": true, | ||
"disallowSpacesInCallExpression": true, | ||
"disallowTrailingComma": true, | ||
"disallowYodaConditions": true, | ||
"maximumLineLength": { | ||
"value": 80, | ||
"tabSize": 4, | ||
"allowComments": false, | ||
"allowUrlComments": true, | ||
"allowRegex": true | ||
}, | ||
"requireBlocksOnNewline": true, | ||
"requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties", | ||
"requireCapitalizedConstructors": true, | ||
"requireCommaBeforeLineBreak": true, | ||
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], | ||
"requireDotNotation": true, | ||
"requireFunctionDeclarations": true, | ||
"requireLineBreakAfterVariableAssignment": true, | ||
"requireLineFeedAtFileEnd": true, | ||
"requirePaddingNewlinesBeforeKeywords": [ | ||
"do", | ||
"for", | ||
"if", | ||
"switch", | ||
"case", | ||
"try", | ||
"void", | ||
"while", | ||
"with", | ||
"return", | ||
"typeof", | ||
"function" | ||
], | ||
"requirePaddingNewLinesBeforeLineComments": { | ||
"allExcept": "firstAfterCurly" | ||
}, | ||
"requirePaddingNewLinesInObjects": true, | ||
"requireParenthesesAroundIIFE": true, | ||
"requireSemicolons": true, | ||
"requireSpaceAfterBinaryOperators": true, | ||
"requireSpaceAfterKeywords": true, | ||
"requireSpaceBeforeBinaryOperators": true, | ||
"requireSpaceBeforeBlockStatements": true, | ||
"requireSpaceBeforeKeywords": [ | ||
"else", | ||
"case", | ||
"catch", | ||
"finally", | ||
"void", | ||
"while", | ||
"with", | ||
"return" | ||
], | ||
"requireSpaceBeforeObjectValues": true, | ||
"requireSpaceBetweenArguments": true, | ||
"requireSpacesInAnonymousFunctionExpression": { | ||
"beforeOpeningRoundBrace": true, | ||
"beforeOpeningCurlyBrace": true | ||
}, | ||
"requireSpacesInConditionalExpression": true, | ||
"requireSpacesInForStatement": true, | ||
"requireSpacesInFunctionDeclaration": { | ||
"beforeOpeningCurlyBrace": true | ||
}, | ||
"safeContextKeyword": ["_this"], | ||
"validateIndentation": "\t", | ||
"validateLineBreaks": "LF", | ||
"validateParameterSeparator": ", ", | ||
"validateQuoteMarks": { | ||
"mark": "'", | ||
"escape": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"curly": true, | ||
"eqeqeq": true, | ||
"freeze": true, | ||
"futurehostile": true, | ||
"globalstrict": true, | ||
"latedef": true, | ||
"maxcomplexity": 8, | ||
"maxdepth": 4, | ||
"maxparams": 4, | ||
"noarg": true, | ||
"nonbsp": true, | ||
"shadow": "outer", | ||
"singleGroups": true, | ||
"undef": true, | ||
"unused": true, | ||
"boss": false, | ||
"evil": false, | ||
"lastsemic": false, | ||
"loopfunc": false, | ||
"validthis": true, | ||
"strict": true, | ||
"devel": true, | ||
"node": true, | ||
"esnext": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# autodiscover.xml | ||
Providers Autodiscover capabilities for IMAP/SMTP services on Microsoft Outlook/Apple Mail and Autoconf capabilities for Thunderbird | ||
Provides Autodiscover capabilities for IMAP/SMTP services on Microsoft Outlook/Apple Mail and Autoconf capabilities for Thunderbird | ||
|
||
[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "Autodiscover.xml", | ||
"description": "Providers Autodiscover capabilities for IMAP/SMTP services on Microsoft Outlook/Apple Mail and Autoconf capabilities for Thunderbird", | ||
"website": "https://tiliq.com", | ||
"repository": "https://github.com/Tiliq/autodiscover.xml", | ||
"keywords": ["tiliq", "autoconfigure", "autoconf", "autodiscover", "outlook", "thunderbird", "apple mail", "imap", "smtp"], | ||
"addons": [ | ||
"papertrail" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const app = require('koa')(); | ||
const swig = require('koa-swig'); | ||
const body = require('koa-buddy'); | ||
const router = require('koa-router')(); | ||
const log = console.log.bind(console); | ||
|
||
function findChild(name, children) { | ||
for (let child of children) { | ||
if (child.name === name) { | ||
return child; | ||
} | ||
} | ||
} | ||
|
||
router.post('/Autodiscover/Autodiscover.xml', function *autodiscover(next) { | ||
log(this.request.headers, this.request.body); | ||
|
||
this.set('Content-Type', 'application/xml'); | ||
|
||
const request = findChild('Request'); | ||
const schema = findChild('AcceptableResponseSchema', request.children); | ||
const email = findChild('EMailAddress', request.children).content; | ||
const username = email.split('@')[0]; | ||
const domain = email.split('@')[1]; | ||
|
||
this.render('autodiscover', { | ||
schema: schema.content, | ||
email, | ||
username, | ||
domain | ||
}); | ||
|
||
yield next; | ||
}); | ||
|
||
app.context.render = swig({ | ||
root: path.join(__dirname, 'views'), | ||
autoescape: true, | ||
cache: 'memory', | ||
ext: 'xml' | ||
}); | ||
|
||
app.use(body()); | ||
app.use(router.routes()); | ||
app.use(router.allowedMethods()); | ||
|
||
app.listen(process.env.PORT || 8000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "autodiscover.xml", | ||
"version": "1.0.0", | ||
"description": "Providers Autodiscover capabilities for IMAP/SMTP services on Microsoft Outlook/Apple Mail and Autoconf capabilities for Thunderbird", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Tiliq/autodiscover.xml.git" | ||
}, | ||
"author": "Kevin J. Martin", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/Tiliq/autodiscover.xml/issues" | ||
}, | ||
"homepage": "https://github.com/Tiliq/autodiscover.xml#readme", | ||
"keywords": [ | ||
"tiliq", | ||
"autoconfigure", | ||
"autoconf", | ||
"autodiscover", | ||
"outlook", | ||
"thunderbird", | ||
"apple mail", | ||
"imap", | ||
"smtp" | ||
], | ||
"dependencies": { | ||
"koa": "^1.0.0", | ||
"koa-buddy": "^0.1.0", | ||
"koa-router": "^5.1.2", | ||
"koa-swig": "^2.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006"> | ||
<Response xmlns="{{schema}}"> | ||
<User> | ||
<DisplayName>{{email}}</DisplayName> | ||
</User> | ||
|
||
<Account> | ||
<AccountType>email</AccountType> | ||
<Action>settings</Action> | ||
|
||
<Protocol> | ||
<Type>IMAP</Type> | ||
<TTL>1</TTL> | ||
|
||
<Server>imap.{{domain}}</Server> | ||
<Port>993</Port> | ||
|
||
<LoginName>{{email}}</LoginName> | ||
|
||
<DomainRequired>on</DomainRequired> | ||
<DomainName>{{domain}}</DomainName> | ||
|
||
<SPA>off</SPA> | ||
<SSL>on</SSL> | ||
<AuthRequired>on</AuthRequired> | ||
</Protocol> | ||
</Account> | ||
|
||
<Account> | ||
<AccountType>email</AccountType> | ||
<Action>settings</Action> | ||
|
||
<Protocol> | ||
<Type>SMTP</Type> | ||
<TTL>1</TTL> | ||
|
||
<Server>imap.{{domain}}</Server> | ||
<Port>587</Port> | ||
|
||
<LoginName>{{email}}</LoginName> | ||
|
||
<DomainRequired>on</DomainRequired> | ||
<DomainName>{{domain}}</DomainName> | ||
|
||
<SPA>off</SPA> | ||
<SSL>on</SSL> | ||
<AuthRequired>on</AuthRequired> | ||
</Protocol> | ||
</Account> | ||
</Response> | ||
</Autodiscover> |