Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go v5 #66

Merged
merged 15 commits into from
Sep 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'use strict';

var pkg = require('./package.json');
var AV_CONFIG_VERSION = '103111.3';
var AV_CONFIG_VERSION = '103111.5';

//Using exclusion patterns slows down Grunt significantly
//instead of creating a set of patterns like '**/*.js' and '!**/node_modules/**'
Expand Down Expand Up @@ -204,13 +204,13 @@ module.exports = function (grunt) {
remove: ['script[data-remove!="false"]','link[data-remove!="false"]'],
append: [
{selector:'body',html:'<%= variables.booth_html_body_include %>'},
{selector:'body',html:'<!--[if lte IE 8]><script src="/booth/libcompat-v103111.3.min.js"></script><![endif]--><!--[if gte IE 9]><script src="/booth/libnocompat-v103111.3.min.js"></script><![endif]--><!--[if !IE]><!--><script src="/booth/libnocompat-v103111.3.min.js"></script><!--<![endif]-->'},
{selector:'body',html:'<!--[if lte IE 8]><script src="/booth/libcompat-v103111.5.min.js"></script><![endif]--><!--[if gte IE 9]><script src="/booth/libnocompat-v103111.5.min.js"></script><![endif]--><!--[if !IE]><!--><script src="/booth/libnocompat-v103111.5.min.js"></script><!--<![endif]-->'},
{selector:'body',html:'<!--All the source code of this program under copyright. Take a look at the license details at https://github.com/agoravoting/agora-core-view/blob/master/README.md -->'},
{selector:'body',html:'<script src="/booth/lib-v103111.3.min.js"></script>'},
{selector:'body',html:'<script src="/booth/avConfig-v103111.3.js"></script>'},
{selector:'body',html:'<script src="/booth/avThemes-v103111.3.js"></script>'},
{selector:'body',html:'<script src="/booth/app-v103111.3.min.js"></script>'},
{selector:'body',html:'<script src="/booth/avPlugins-v103111.3.js"></script>'},
{selector:'body',html:'<script src="/booth/lib-v103111.5.min.js"></script>'},
{selector:'body',html:'<script src="/booth/avConfig-v103111.5.js"></script>'},
{selector:'body',html:'<script src="/booth/avThemes-v103111.5.js"></script>'},
{selector:'body',html:'<script src="/booth/app-v103111.5.min.js"></script>'},
{selector:'body',html:'<script src="/booth/avPlugins-v103111.5.js"></script>'},
{selector:'head',html:'<link rel="stylesheet" id="theme" data-base="/booth/" href="/booth/themes/default/app.min.css">'}
]
},
Expand Down Expand Up @@ -243,9 +243,9 @@ module.exports = function (grunt) {
],
'temp/lib.js': ['<%= dom_munger.data.libjs %>'],
'temp/app.js': ['<%= dom_munger.data.appjs %>','<%= ngtemplates.main.dest %>'],
'dist/avConfig-v103111.3.js': ['avConfig.js'],
'dist/avThemes-v103111.3.js': ['bower_components/avCommon/dist/avThemes-v103111.3.js'],
'dist/avPlugins-v103111.3.js': ['plugins/**/*.js']
'dist/avConfig-v103111.5.js': ['avConfig.js'],
'dist/avThemes-v103111.5.js': ['bower_components/avCommon/dist/avThemes-v103111.5.js'],
'dist/avPlugins-v103111.5.js': ['plugins/**/*.js']
}
}
},
Expand Down Expand Up @@ -277,10 +277,10 @@ module.exports = function (grunt) {
beautify: true
},
files: {
'dist/app-v103111.3.min.js': 'temp/app.js',
'dist/lib-v103111.3.min.js': 'temp/lib.js',
'dist/libnocompat-v103111.3.min.js': 'temp/libnocompat.js',
'dist/libcompat-v103111.3.min.js': 'temp/libcompat.js',
'dist/app-v103111.5.min.js': 'temp/app.js',
'dist/lib-v103111.5.min.js': 'temp/lib.js',
'dist/libnocompat-v103111.5.min.js': 'temp/libnocompat.js',
'dist/libcompat-v103111.5.min.js': 'temp/libcompat.js',
'dist/avWidgets.min.js': 'avWidgets.js',

"dist/locales/moment/en.js": "bower_components/moment/lang/en-gb.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ angular.module('avBooth')
{
return;
},
"desborda3": function()
{
return Math.max(1, Math.floor(scope.question.num_winners * 1.3) - scope.option.selected);
},
"desborda2": function()
{
return Math.max(1, Math.floor(scope.question.num_winners * 1.3) - scope.option.selected);
Expand Down
5 changes: 5 additions & 0 deletions avBooth/booth-directive/booth-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ angular.module('avBooth')
sorted: true,
ordered: true
},
"desborda3": {
state: stateEnum.multiQuestion,
sorted: true,
ordered: true
},
"desborda2": {
state: stateEnum.multiQuestion,
sorted: true,
Expand Down
4 changes: 4 additions & 0 deletions avBooth/review-ballot-directive/review-ballot-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ angular.module('avBooth')
{
return;
},
"desborda3": function()
{
return Math.max(1, Math.floor(question.num_winners * 1.3) - answer.selected);
},
"desborda2": function()
{
return Math.max(1, Math.floor(question.num_winners * 1.3) - answer.selected);
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "agoraGuiBooth",
"version" : "103111.3",
"version" : "103111.5",
"main": "index.html",
"ignore": [
"**/.*",
Expand Down
2 changes: 1 addition & 1 deletion crypto/answer-encoder-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ angular.module('avCrypto')

return function (requestedCodec, numAvailableOptions) {
var multi = {
validCodecs: ["plurality-at-large", "borda-nauru", "borda", "desborda2", "desborda"],
validCodecs: ["plurality-at-large", "borda-nauru", "borda", "desborda3", "desborda2", "desborda"],
numAvailableOptions: numAvailableOptions,

/**
Expand Down
11 changes: 9 additions & 2 deletions crypto/encrypt-answer-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,17 @@ angular.module('avCrypto')

// checking that encoding a number to a member of the group and then
// decoding it returns the same number. This will usually detect if
// a number too big to encode in the group
// a number too big to encode in the group.
//
// Because the number coming from the group will never have a zero to
// the left but the origin plain_answer might, we strip the zeros to
// the left of plain_answer. We could convert them to BigInts both
// and compare but seems overkill, and we cannot convert them to ints
// because the numbers might be bigger than the max-safe-int in
// javascript, so that's why are we still comparing them as strings.
var plainAnswerDecoded = plaintext.getPlaintext();
if (!!error_func &&
(plainAnswerDecoded.toJSONObject()+"" !== plain_answer+""))
(plainAnswerDecoded.toJSONObject()+"" !== plain_answer.replace(/^0+/, "")+""))
{
error_func("errorEncoding", "error while encoding the number to a member of the group");
}
Expand Down
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<script src="/ie8-bind-workaround.js"></script>

<!-- JS from Bower Components -->
<script src="bower_components/avCommon/dist/libnocompat-v103111.3.js" class="libnocompat"></script>
<script src="bower_components/avCommon/dist/libCommon-v103111.3.js" class="lib"></script>
<script src="bower_components/avCommon/dist/libnocompat-v103111.5.js" class="libnocompat"></script>
<script src="bower_components/avCommon/dist/libCommon-v103111.5.js" class="lib"></script>
<script src="bower_components/is_js/is.min.js" class="lib"></script>
<script src="bower_components/dragdroptouch/DragDropTouch.js" class="lib"></script>

Expand All @@ -34,7 +34,7 @@
<script src="avConfig.js"></script>

<!-- avCommon -->
<script src="bower_components/avCommon/dist/appCommon-v103111.3.js" class="app"></script>
<script src="bower_components/avCommon/dist/appCommon-v103111.5.js" class="app"></script>

<script src="crypto/crypto.js" class="app"></script>
<script src="crypto/random-service.js" class="app"></script>
Expand Down
2 changes: 1 addition & 1 deletion locales/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"poweredBy": "Funciona amb <strong>__name__</strong>",
"shareLink": "¡Tuitgeu aquesta votació!",
"votingSystem": "Sistema de votació",
"votings": {"plurality-at-large": "Plurality at large", "borda-nauru": "Nauru's Borda Count or Borda Dowdall (1/n)", "borda": "Borda Count (traditional)", "pairwise-beta": "Pairwise (beta-distribution)", "desborda2": "DesBorda2", "desborda": "DesBorda"}
"votings": {"plurality-at-large": "Plurality at large", "borda-nauru": "Nauru's Borda Count or Borda Dowdall (1/n)", "borda": "Borda Count (traditional)", "pairwise-beta": "Pairwise (beta-distribution)", "desborda3": "DesBorda3", "desborda2": "DesBorda2", "desborda": "DesBorda"}
},
"avBooth": {
"legal": {
Expand Down
2 changes: 1 addition & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"poweredBy": "Powered by <strong><a href=\"__url__\" target=\"_blank\">__name__</a></strong>",
"shareLink": "¡Tweet this election!",
"votingSystem": "Voting System",
"votings": {"plurality-at-large": "Plurality at large", "borda-nauru": "Nauru's Borda Count or Borda Dowdall (1/n)", "borda": "Borda Count (traditional)", "pairwise-beta": "Pairwise (beta-distribution)", "desborda2": "DesBorda2", "desborda": "DesBorda"}
"votings": {"plurality-at-large": "Plurality at large", "borda-nauru": "Nauru's Borda Count or Borda Dowdall (1/n)", "borda": "Borda Count (traditional)", "pairwise-beta": "Pairwise (beta-distribution)", "desborda3": "DesBorda3", "desborda2": "DesBorda2", "desborda": "DesBorda"}
},
"avBooth": {
"legal": {
Expand Down
2 changes: 1 addition & 1 deletion locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"poweredBy": "Funciona con <strong><a href=\"__url__\" target=\"_blank\">__name__</a></strong>",
"shareLink": "¡Twittea esta votación!",
"votingSystem": "Sistema de Voto",
"votings": {"plurality-at-large": "Voto en bloque o Escrutinio Mayoritario Plurinominal", "borda-nauru": "Borda de Nauru o Borda Dowdall (1/n)", "borda": "Borda Count (tradicional)", "pairwise-beta": "Comparación de pares (distribución beta)", "desborda2": "DesBorda2", "desborda": "DesBorda"}
"votings": {"plurality-at-large": "Voto en bloque o Escrutinio Mayoritario Plurinominal", "borda-nauru": "Borda de Nauru o Borda Dowdall (1/n)", "borda": "Borda Count (tradicional)", "pairwise-beta": "Comparación de pares (distribución beta)", "desborda3": "DesBorda3", "desborda2": "DesBorda2", "desborda": "DesBorda"}
},
"avBooth": {
"legal": {
Expand Down
2 changes: 1 addition & 1 deletion locales/gl.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"poweredBy": "Funciona amb <strong><a href=\"__url__\" target=\"_blank\">__name__</a></strong>",
"shareLink": "Comparte en Twitter que xa votaches nas primarias de En Marea",
"votingSystem": "Voting System",
"votings": {"plurality-at-large": "Plurality at large", "borda-nauru": "Nauru's Borda Count or Borda Dowdall (1/n)", "borda": "Borda Count (traditional)", "pairwise-beta": "Pairwise (beta-distribution)", "desborda2": "DesBorda2", "desborda": "DesBorda"}
"votings": {"plurality-at-large": "Plurality at large", "borda-nauru": "Nauru's Borda Count or Borda Dowdall (1/n)", "borda": "Borda Count (traditional)", "pairwise-beta": "Pairwise (beta-distribution)", "desborda3": "DesBorda3", "desborda2": "DesBorda2", "desborda": "DesBorda"}
},
"avBooth": {
"legal": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "agora-gui-booth",
"version" : "103111.3.0",
"version" : "103111.5.0",
"devDependencies": {
"grunt": "~0.4",
"grunt-angular-templates": "~0.5",
Expand All @@ -18,7 +18,7 @@
"grunt-contrib-watch": "~0.6",
"grunt-dom-munger": "~3.4",
"grunt-karma": "~0.8.3",
"grunt-merge-json": "^0.9.5",
"grunt-merge-json": "0.9.5",
"grunt-ng-annotate": "^0.9.2",
"grunt-protractor-runner": "^1.1.4",
"karma": "~0.12.6",
Expand Down
5 changes: 4 additions & 1 deletion vendor/crypto/elgamal.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,12 @@ ElGamal.Plaintext = Class.extend({

this.pk = pk;

// encode to m * legendre(m|p)
if (encode_m) {
// need to encode the message given that p = 2q+1
var y = m.add(BigInt.ONE);

// euler criterion to determine quadratic residuosity
var test = y.modPow(pk.q, pk.p);
if (test.equals(BigInt.ONE)) {
this.m = y;
Expand Down Expand Up @@ -593,4 +596,4 @@ ElGamal.fiatshamir_dlog_challenge_generator = function(commitment) {
// return new BigInt(hex_sha256(commitment.toJSONObject()), 16);
return new BigInt(hex_sha256(commitment.toString()), 16);
};
/* jshint ignore:end */
/* jshint ignore:end */