well done

This commit is contained in:
syuilo 2017-02-22 04:19:53 +09:00
parent 7203c176e8
commit 9820a691c1
12 changed files with 58 additions and 8 deletions

View file

@ -31,8 +31,7 @@ and more! You can touch with your own eyes at https://misskey.xyz/.
2. `git clone git://github.com/syuilo/misskey.git` 2. `git clone git://github.com/syuilo/misskey.git`
3. `cd misskey` 3. `cd misskey`
4. `npm install` 4. `npm install`
5. `npm run config` 5. `npm run build`
6. `npm run build`
GLHF! GLHF!
@ -92,6 +91,7 @@ If you want to run misskey in production mode, add `--env NODE_ENV=production` l
Note that `$(pwd)` is the working directory. Note that `$(pwd)` is the working directory.
## Launch ## Launch
(初回起動時はまず `npm run config` してください)
`sudo npm start` `sudo npm start`
## Debugging :bug: ## Debugging :bug:

View file

@ -17,11 +17,13 @@ require('./common/tags');
"use strict"; "use strict";
const CONFIG = require('./common/scripts/config');
document.domain = CONFIG.host; document.domain = CONFIG.host;
// Set global configration // Set global configration
riot.mixin({ riot.mixin({
CONFIG: CONFIG CONFIG
}); });
// ↓ iOS待ちPolyfill (SEE: http://caniuse.com/#feat=fetch) // ↓ iOS待ちPolyfill (SEE: http://caniuse.com/#feat=fetch)

View file

@ -2,6 +2,8 @@
* API Request * API Request
*/ */
const CONFIG = require('./config');
let spinner = null; let spinner = null;
let pending = 0; let pending = 0;

View file

@ -0,0 +1,18 @@
const url = new URL(location.href);
const isRoot = url.host.split('.')[0] == 'misskey';
const host = isRoot ? url.host : url.host.substring(url.host.indexOf('.') + 1, url.host.length);
const scheme = url.protocol;
const apiUrl = `${scheme}//api.${host}`;
const devUrl = `${scheme}//dev.${host}`;
const aboutUrl = `${scheme}//about.${host}`;
module.exports = {
host,
scheme,
apiUrl,
devUrl,
aboutUrl,
themeColor: '#f76d6c'
};

View file

@ -1,5 +1,6 @@
const ReconnectingWebSocket = require('reconnecting-websocket'); const ReconnectingWebSocket = require('reconnecting-websocket');
const riot = require('riot'); const riot = require('riot');
const CONFIG = require('./config');
class Connection { class Connection {
constructor(me, otherparty) { constructor(me, otherparty) {

View file

@ -1,3 +1,5 @@
const CONFIG = require('./config');
module.exports = () => { module.exports = () => {
localStorage.removeItem('me'); localStorage.removeItem('me');
document.cookie = `i=; domain=.${CONFIG.host}; expires=Thu, 01 Jan 1970 00:00:01 GMT;`; document.cookie = `i=; domain=.${CONFIG.host}; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;

View file

@ -1,5 +1,6 @@
const ReconnectingWebSocket = require('reconnecting-websocket'); const ReconnectingWebSocket = require('reconnecting-websocket');
const riot = require('riot'); const riot = require('riot');
const CONFIG = require('./config');
module.exports = me => { module.exports = me => {
let state = 'initializing'; let state = 'initializing';

View file

@ -1,5 +1,6 @@
const riot = require('riot'); const riot = require('riot');
const nyaize = require('nyaize').default; const nyaize = require('nyaize').default;
const CONFIG = require('./config');
const escape = function(text) { const escape = function(text) {
return text return text

View file

@ -30,7 +30,7 @@
</label> </label>
<label class="recaptcha"> <label class="recaptcha">
<p class="caption"><i class="fa fa-toggle-on" if={ recaptchaed }></i><i class="fa fa-toggle-off" if={ !recaptchaed }></i>認証</p> <p class="caption"><i class="fa fa-toggle-on" if={ recaptchaed }></i><i class="fa fa-toggle-off" if={ !recaptchaed }></i>認証</p>
<div class="g-recaptcha" data-callback="onRecaptchaed" data-expired-callback="onRecaptchaExpired" data-sitekey={ CONFIG.recaptcha.siteKey }></div> <div if={ recaptcha } class="g-recaptcha" data-callback="onRecaptchaed" data-expired-callback="onRecaptchaExpired" data-sitekey={ recaptcha.siteKey }></div>
</label> </label>
<label class="agree-tou"> <label class="agree-tou">
<input name="agree-tou" type="checkbox" autocomplete="off" required="required"/> <input name="agree-tou" type="checkbox" autocomplete="off" required="required"/>
@ -193,10 +193,20 @@
}; };
this.on('mount', () => { this.on('mount', () => {
const head = document.getElementsByTagName('head')[0]; fetch('/config.json').then(res => {
const script = document.createElement('script'); res.json().then(conf => {
script.setAttribute('src', 'https://www.google.com/recaptcha/api.js'); this.update({
head.appendChild(script); recaptcha: {
siteKey: conf.recaptcha.siteKey
}
});
const head = document.getElementsByTagName('head')[0];
const script = document.createElement('script');
script.setAttribute('src', 'https://www.google.com/recaptcha/api.js');
head.appendChild(script);
});
});
}); });
this.onChangeUsername = () => { this.onChangeUsername = () => {

View file

@ -1,4 +1,5 @@
const riot = require('riot'); const riot = require('riot');
const CONFIG = require('../../common/scripts/config');
const dialog = require('./dialog'); const dialog = require('./dialog');
const api = require('../../common/scripts/api'); const api = require('../../common/scripts/api');

View file

@ -1,4 +1,5 @@
const riot = require('riot'); const riot = require('riot');
const CONFIG = require('../../common/scripts/config');
const dialog = require('./dialog'); const dialog = require('./dialog');
const api = require('../../common/scripts/api'); const api = require('../../common/scripts/api');

View file

@ -51,6 +51,17 @@ app.get(/\/api:meta/, require('./meta'));
app.get(/\/api:url/, require('./service/url-preview')); app.get(/\/api:url/, require('./service/url-preview'));
app.post(/\/api:rss/, require('./service/rss-proxy')); app.post(/\/api:rss/, require('./service/rss-proxy'));
/**
* Serve config
*/
app.get('/config.json', (req, res) => {
res.send({
recaptcha: {
siteKey: config.recaptcha.siteKey
}
});
});
/** /**
* Subdomain * Subdomain
*/ */