MattermostのURLをユーザーごとの設定フォルダに保存するように変更

This commit is contained in:
Yuya Ochiai
2015-10-09 22:50:48 +09:00
parent 6de38f9b32
commit e86c7f31f6
4 changed files with 55 additions and 2 deletions

34
settings.html Normal file
View File

@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Settings</title>
</head>
<body>
<h1>Settings</h1>
<p>URL: <input type="text" id="url"></p>
<input type="button" value="OK" onclick="saveSettings()">
<input type="button" value="Cancel" onclick="goBack()">
<script type="text/javascript">
var remote = require('remote');
var fs = require('fs');
var saveSettings = function(){
var configFile = remote.require('app').getPath('userData') + '/config.json';
var urlInput = document.getElementById('url');
var config = {
url: urlInput.value
};
fs.writeFile(configFile, JSON.stringify(config, null, ' '), function(err){
if(err) throw err;
window.location.href = './index.html';
});
}
var goBack = function(){
remote.getCurrentWindow().webContents.goBack();
}
</script>
</body>
</html>